===================================================================
@@ -10068,11 +10067,6 @@ fold_binary_loc (location_t loc,
&& op0 != NULL_TREE
&& op1 != NULL_TREE);
- extern tree generic_simplify (enum tree_code, tree, tree, tree);
- tem = generic_simplify (code, type, op0, op1);
- if (tem)
- return tem;
-
arg0 = op0;
arg1 = op1;
@@ -10130,6 +10124,11 @@ fold_binary_loc (location_t loc,
}
}
+ extern tree generic_simplify (enum tree_code, tree, tree, tree);
+ tem = generic_simplify (code, type, op0, op1);
+ if (tem)
+ return tem;
+
/* If this is a commutative operation, and ARG0 is a constant, move it
to ARG1 to reduce the number of tests below. */
if (commutative_tree_code (code)
===================================================================
@@ -20,7 +20,17 @@ along with GCC; see the file COPYING3.
(for op in plus pointer_plus minus bit_ior bit_xor
(simplify
(op @0 integer_zerop)
- @0))
+#if GENERIC
+ /* ??? fold_binary adds non_lvalue here and "fixes" the C++
+ run of Wsizeof-pointer-memaccess1.c, preserving enough of
+ sizeof (&a) + 0 because sizeof (&a) is maybe_lvalue_p ()
+ for no good reason. The C frontend is fine as it doesn't
+ fold too early. */
+ (non_lvalue @0)
+#else
+ @0
+#endif
+ ))
(simplify
(minus @0 @0)