public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "williambader at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter
Date: Fri, 12 Mar 2021 04:11:30 +0000	[thread overview]
Message-ID: <bug-89965-4-8uHS5V3oV0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-89965-4@http.gcc.gnu.org/bugzilla/>

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.

       reply	other threads:[~2021-03-12  4:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-89965-4@http.gcc.gnu.org/bugzilla/>
2021-03-12  4:11 ` williambader at hotmail dot com [this message]
2021-03-15  0:41 ` williambader at hotmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-89965-4-8uHS5V3oV0@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).