aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-12-15 13:01:47 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-12-15 13:01:47 +0000
commit249700b5f180c66cab7ea3914db89ac77c6e1e25 (patch)
tree8ec6e02620a39d9d92b51c578294be9d51965088
parent024660c5942a95a54712adc9e91953ca83081c07 (diff)
downloadgcc-249700b5f180c66cab7ea3914db89ac77c6e1e25.zip
gcc-249700b5f180c66cab7ea3914db89ac77c6e1e25.tar.gz
gcc-249700b5f180c66cab7ea3914db89ac77c6e1e25.tar.bz2
re PR tree-optimization/64295 (ICE: SIGSEGV (infinite recursion) with -frounding-math -funsafe-math-optimizations)
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/match.pd2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr64295.c8
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6683625..3e3eda6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/match.pd b/gcc/match.pd
index 4ccb41a..083d65f 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8ed52f9..a4b8957 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..4882f32
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64295.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O -frounding-math -funsafe-math-optimizations" } */
+
+double
+f (double g)
+{
+ return g / 3;
+}