This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/70941] [5/6/7 Regression] Test miscompiled with -O2.


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70941

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following fixes this.

Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c    (revision 235859)
+++ gcc/fold-const.c    (working copy)
@@ -838,9 +838,8 @@ split_tree (location_t loc, tree in, tre
        *conp = negate_expr (*conp);
       if (neg_var_p)
        {
-         /* Convert to TYPE before negating a pointer type expr.  */
-         if (var && POINTER_TYPE_P (TREE_TYPE (var)))
-           var = fold_convert_loc (loc, type, var);
+         /* Convert to TYPE before negating.  */
+         var = fold_convert_loc (loc, type, var);
          var = negate_expr (var);
        }
     }
@@ -863,9 +862,8 @@ split_tree (location_t loc, tree in, tre
       else if (*minus_litp)
        *litp = *minus_litp, *minus_litp = 0;
       *conp = negate_expr (*conp);
-      /* Convert to TYPE before negating a pointer type expr.  */
-      if (var && POINTER_TYPE_P (TREE_TYPE (var)))
-       var = fold_convert_loc (loc, type, var);
+      /* Convert to TYPE before negating.  */
+      var = fold_convert_loc (loc, type, var);
       var = negate_expr (var);
     }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]