This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/70941] [5/6/7 Regression] Test miscompiled with -O2.
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 04 May 2016 09:50:41 +0000
- Subject: [Bug target/70941] [5/6/7 Regression] Test miscompiled with -O2.
- Auto-submitted: auto-generated
- References: <bug-70941-4 at http dot gcc dot gnu dot org/bugzilla/>
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);
}