[Bug rtl-optimization/87096] "Optimised" snprintf is not POSIX conformant

bugdal at aerifal dot cx gcc-bugzilla@gcc.gnu.org
Mon Aug 27 13:47:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096

--- Comment #4 from Rich Felker <bugdal at aerifal dot cx> ---
I'm aware, but that makes it an invalid transformation. To be valid, the
transformation must only be performed in cases where it's provably not
exceptional.

The same principle applies to all the pathological results where
p=malloc(SIZE_MAX);if(!p)...;free(p) is getting optimized out (breaking code
that relies on "if malloc succeeds, pointer arithmetic in the allocated object
is valid"). This kind of error is a high-level optimization strategy mistake in
gcc that needs to be addressed and fixed.


More information about the Gcc-bugs mailing list