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);
}