[Bug middle-end/43057] [LTO] fold check: original tree changed by fold

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Nov 20 16:28:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43057

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.11.20 16:13:06
     Ever Confirmed|0                           |1

--- Comment #6 from Uros Bizjak <ubizjak at gmail dot com> 2010-11-20 16:13:06 UTC ---
Following untested patch fixes the failure:

Index: fold-const.c
===================================================================
--- fold-const.c    (revision 166974)
+++ fold-const.c    (working copy)
@@ -13415,7 +13415,7 @@ fold_ternary_loc (location_t loc, enum t
          a COND, which will recurse.  In that case, the COND_EXPR
          is probably the best choice, so leave it alone.  */
       && type == TREE_TYPE (arg0))
-    return pedantic_non_lvalue_loc (loc, arg0);
+    return pedantic_non_lvalue_loc (loc, unshare_expr (arg0));

       /* Convert A ? 0 : 1 to !A.  This prefers the use of NOT_EXPR
      over COND_EXPR in cases such as floating point comparisons.  */



More information about the Gcc-bugs mailing list