https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119321
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic, false-positive,
| |missed-optimization
Last reconfirmed| |2025-03-17
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
There's likely a duplicate for this. Note at -O2 we produce the same
jump-thread but not diagnose this. The difference is at -O1 we have
if (x > 0)
...
else
malloc ((unsigned long)x);
and at -O2 we do
tem = (unsigned long)x;
if (x > 0)
...
else
malloc (tem);
With -O2 -fno-code-hoisting we diagnose it again.
This is also a code-size pessimization of course.