https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78847
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
A simple fold-const.c "fix" is the following:
Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c (revision 245276)
+++ gcc/fold-const.c (working copy)
@@ -785,7 +785,9 @@ split_tree (location_t loc, tree in, tre
the value is not affected. For reals, the value might be
affected, so we can't. */
&& ((code == PLUS_EXPR && TREE_CODE (in) == MINUS_EXPR)
- || (code == MINUS_EXPR && TREE_CODE (in) == PLUS_EXPR))))
+ || (code == MINUS_EXPR
+ && (TREE_CODE (in) == PLUS_EXPR
+ || TREE_CODE (in) == POINTER_PLUS_EXPR)))))
{
tree op0 = TREE_OPERAND (in, 0);
tree op1 = TREE_OPERAND (in, 1);
I'm giving it bootstrap/regtest - that would be likely a quite beneficial
change for all the middle-end machinery still using GENERIC...