[Bug tree-optimization/102676] Failure to optimize out malloc/nothrow allocation that's only used for bool checking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102676 Richard Biener changed: What|Removed |Added Last reconfirmed||2021-10-11 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #3 from Richard Biener --- We don't eliminate a malloc that's just used in a conditional, I think there's a related bugreport with p = malloc (n) if (!p) abort (); free (p); or sth like that where we fail to elide the allocation. Note in this case failing allocation _would_ have a side-effect.
[Bug tree-optimization/102676] Failure to optimize out malloc/nothrow allocation that's only used for bool checking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102676 --- Comment #2 from Gabriel Ravier --- Well, I think the assumption LLVM is making is that the allocation, being unused, can just be eliminated and considered to have always succeeded. I don't see how that would contradict the standard, although I suppose some would consider it a bad thing to do for the compiler (although in that case you might as well rule out all optimizations that elide allocations).
[Bug tree-optimization/102676] Failure to optimize out malloc/nothrow allocation that's only used for bool checking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102676 --- Comment #1 from Andreas Schwab --- Why is malloc(1) always true?