https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102676
Kang-Che Sung <Explorer09 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Explorer09 at gmail dot com --- Comment #4 from Kang-Che Sung <Explorer09 at gmail dot com> --- Why am I feeling this optimization is a totality bad idea? The example code by the OP doesn't free the memory buffer, which means a leak. This should be a warning about the memory leak instead. Besides, you can't expect malloc(1) to always succeed. If your program has run out of memory quota, malloc() would fail.