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

William Bader <williambader at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |williambader at hotmail dot com

--- Comment #17 from William Bader <williambader at hotmail dot com> ---
Something similar to this might be back in gcc 10.

I have gcc-10.2.1-9.fc32.x86_64 (gcc 10.2.1 from Fedora 32) and it also happens
on gcc-10.2.0 built from source on CentOS 6.10.
I have a 64 bit CPU, but I am building a 32 bit executable.
I have a 30K line C module that misbehaves with "-O1 -fcaller-saves
-fexpensive-optimizations".

It works with less optimization (-O1, -O0, or either of -fcaller-saves or
-fexpensive-optimizations removed).

It works under under valgrind (and does not show any uninitialized variables or
memory overwrites).

I have debug code like "if (debug) fprintf(stderr, ...);"
It works if I set debug to 1. It also works if I go to any of several debug
statements and change "if (debug)" to "if (debug || 1)".
It seems as if one of the local variables is getting messed up, and either the
preparation or clean up after a fprintf() call invalidates the register with
the variable or gets a fresh copy from the stack.

I suppose that it would be impossible to track down without an example, but if
anyone has a similar problem with the combination of 32 bit Intel + -O1 +
-fcaller-saves + -fexpensive-optimizations, maybe this comment will add another
data point, and if there is a patch, I could try to build it.
  • [Bug rtl-optimization/89965] ... williambader at hotmail dot com via Gcc-bugs

Reply via email to