https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122201
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2025-10-08
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's not valid to turn *a + *b + *c + *d - *a into *b + *c + *d if you
consider *a == INT_MAX, *b == -INT_MAX, *c == -2, *d == INT_MAX or
a similar setup. Invalid unless we turn the operation into unsigned
when re-association manages to do an optimization.
So my idea wrt the reassoc pass was that we should, for signed integers
(or mixed signed/unsigned), optimize but when we cannot eliminate any
terms avoid doing any code changes and when materialization, try to
leave a "tail" unmodified and only rewrite a minimal portion to unsigned.