re PR tree-optimization/64295 (ICE: SIGSEGV (infinite recursion) with -frounding...
authorRichard Biener <rguenther@suse.de>
Mon, 15 Dec 2014 13:01:47 +0000 (13:01 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 15 Dec 2014 13:01:47 +0000 (13:01 +0000)
2014-12-15  Richard Biener  <rguenther@suse.de>

PR middle-end/64295
* match.pd (X / CST -> X * (1 / CST): Use const_binop instead of
fold_binary to compute the constant to multiply with.

* gcc.dg/pr64295.c: New testcase.

From-SVN: r218748

gcc/ChangeLog
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr64295.c [new file with mode: 0644]

index 6683625..3e3eda6 100644 (file)
@@ -1,5 +1,11 @@
 2014-12-15  Richard Biener  <rguenther@suse.de>
 
+       PR middle-end/64295
+       * match.pd (X / CST -> X * (1 / CST): Use const_binop instead of
+       fold_binary to compute the constant to multiply with.
+
+2014-12-15  Richard Biener  <rguenther@suse.de>
+
        PR middle-end/64246
        * cfgloop.c (mark_loop_for_removal): Make safe against multiple
        invocations on the same loop.
index 4ccb41a..083d65f 100644 (file)
@@ -186,7 +186,7 @@ along with GCC; see the file COPYING3.  If not see
    (if (flag_reciprocal_math
        && !real_zerop (@1))
     (with
-     { tree tem = fold_binary (RDIV_EXPR, type, build_one_cst (type), @1); }
+     { tree tem = const_binop (RDIV_EXPR, type, build_one_cst (type), @1); }
      (if (tem)
       (mult @0 { tem; } ))))
    (if (cst != COMPLEX_CST)
index 8ed52f9..a4b8957 100644 (file)
@@ -1,5 +1,10 @@
 2014-12-15  Richard Biener  <rguenther@suse.de>
 
+       PR middle-end/64295
+       * gcc.dg/pr64295.c: New testcase.
+
+2014-12-15  Richard Biener  <rguenther@suse.de>
+
        PR middle-end/64246
        * gnat.dg/opt46.adb: New testcase.
        * gnat.dg/opt46.ads: Likewise.
diff --git a/gcc/testsuite/gcc.dg/pr64295.c b/gcc/testsuite/gcc.dg/pr64295.c
new file mode 100644 (file)
index 0000000..4882f32
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O -frounding-math -funsafe-math-optimizations" } */
+
+double
+f (double g)
+{
+  return g / 3;
+}