public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter
       [not found] <bug-89965-4@http.gcc.gnu.org/bugzilla/>
@ 2021-03-12  4:11 ` williambader at hotmail dot com
  2021-03-15  0:41 ` williambader at hotmail dot com
  1 sibling, 0 replies; 2+ messages in thread
From: williambader at hotmail dot com @ 2021-03-12  4:11 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter
       [not found] <bug-89965-4@http.gcc.gnu.org/bugzilla/>
  2021-03-12  4:11 ` [Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter williambader at hotmail dot com
@ 2021-03-15  0:41 ` williambader at hotmail dot com
  1 sibling, 0 replies; 2+ messages in thread
From: williambader at hotmail dot com @ 2021-03-15  0:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from William Bader <williambader at hotmail dot com> ---
I did a bisection for the bug from my previous comment (which is still present
in the current gcc 11 in master):

058e97ecf33ad0dfd926b3876a4bcf59ac9556ff is the first bad commit
commit 058e97ecf33ad0dfd926b3876a4bcf59ac9556ff
Author: Vladimir Makarov <vmakarov@redhat.com>
Date:   Tue Aug 26 12:39:58 2008 +0000

`git diff '058e97ecf33ad0dfd926b3876a4bcf59ac9556ff^!' | wc -l` shows 16192
lines.

gcc/caller-save.c has a lot of changes. I want it fixed in the current gcc. I
don't care about gcc 4, other than that the git bisect found that the bug was
introduced in a commit to gcc 4. Is it worth trying to fix it in gcc 4, or
would that just waste time making a patch that would not apply to the current
gcc?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-15  0:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-89965-4@http.gcc.gnu.org/bugzilla/>
2021-03-12  4:11 ` [Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter williambader at hotmail dot com
2021-03-15  0:41 ` williambader at hotmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).