[Bug target/99621] [8/9/10/11 Regression] Wrong code with -m32 -O1 -fcaller-saves -fexpensive-optimizations since g:058e97ecf33ad0dfd926b3876a4bcf59ac9556ff

williambader at hotmail dot com gcc-bugzilla@gcc.gnu.org
Wed Mar 17 09:03:09 GMT 2021


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

--- Comment #10 from William Bader <williambader at hotmail dot com> ---
The program before creduce has debug code. Setting the variable to print the
debug code makes the program work. Usually for something like this, I would put
in debug code and see where the good and bad versions first differ, but that
doesn't work because any call to an external function (even to an empty
function) makes the program work. That is why I first suspected it was related
to -fcaller-saves.
In MSDOS days, stdio data was often in low memory, and null pointer references
would sometimes get into stdio buffers, and adding a printf would keep it from
doing damage, but I do not think that is the case with this program because
just calling a an empty function makes it work. Also, the program runs cleanly
in valgrind, gcc -fsanitize=undefined, and bounds-checking-gcc
http://williambader.com/bounds/example.html 
and neither gcc, gcc -fanalyzer, or clang give warnings about uninitialized
variables.


More information about the Gcc-bugs mailing list