https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126171
liu zhenyu <lzy20000419 at outlook dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lzy20000419 at outlook dot com
--- Comment #12 from liu zhenyu <lzy20000419 at outlook dot com> ---
Here is another small reproducer of the same SCEV "minus INT_MIN" problem,
found by differential testing.
It still miscompiles with GCC 14.4 and 15.3 (and Debian 14.2.0-19) at `-O2
-fno-tree-ccp`, while 16.2 and trunk
are correct, so a backport to the 15 and 14 branches might be worth
considering.
```c
#include <stdio.h>
int gd1;
unsigned f2(int c, int d) {
while (1) {
if (d - c >= gd1)
break;
d = d + 2147482648 - -1000;
}
return d;
}
int main() { printf("%u\n", f2(255, -8)); }
```
Expected `2147483640`; 14.x/15.x print `4294967288` (the loop is removed). No
UB (`-fsanitize=undefined` clean;
the intermediate values are 2147482640 and 2147483640).
Disclaimer: This test case was generated by a fuzzer, and the report was
written with LLM assistance.