This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR64199
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Dec 2014 12:51:03 +0100 (CET)
- Subject: [PATCH] Fix PR64199
- Authentication-results: sourceware.org; auth=none
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2014-12-09 Richard Biener <rguenther@suse.de>
PR middle-end/64199
* fold-const.c (fold_binary_loc): Use TREE_OVERFLOW_P.
* gcc.dg/torture/pr64199.c: New testcase.
Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c (revision 218479)
+++ gcc/fold-const.c (working copy)
@@ -10398,8 +10415,8 @@ fold_binary_loc (location_t loc,
/* Don't introduce overflows through reassociation. */
if (!any_overflows
- && ((lit0 && TREE_OVERFLOW (lit0))
- || (minus_lit0 && TREE_OVERFLOW (minus_lit0))))
+ && ((lit0 && TREE_OVERFLOW_P (lit0))
+ || (minus_lit0 && TREE_OVERFLOW_P (minus_lit0))))
return NULL_TREE;
if (minus_lit0)
Index: gcc/testsuite/gcc.dg/torture/pr64199.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr64199.c (revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr64199.c (working copy)
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffast-math -frounding-math" } */
+
+float
+foo (void)
+{
+ return 1.1f + 2.2f + 2.2f;
+}