public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zhonghao at pku dot org.cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/105997] New: A possible optimization bug
Date: Thu, 16 Jun 2022 08:47:30 +0000	[thread overview]
Message-ID: <bug-105997-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105997
           Summary: A possible optimization bug
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

ZynAddSubFX is a musical synthesizer. I find a strange code in this project:

https://github.com/zynaddsubfx/zynaddsubfx/blob/master/src/Misc/MiddleWare.cpp

#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
#pragma GCC push_options
#pragma GCC optimize("O0")
#endif

void gcc_10_1_0_is_dumb(const std::vector<std::string> &files,
        const int N,
        char *types,
        rtosc_arg_t *args)
{
        types[N] = 0;
        for(int i=0; i<N; ++i) {
            args[i].s = files[i].c_str();
            types[i]  = 's';
        }
}

#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
#pragma GCC pop_options
#endif


I checked its commit, and found a message that complained an optimization bug
in gcc:

https://github.com/zynaddsubfx/zynaddsubfx/commit/a1abae354e826802f8b6f990cae225d6fb06b2ac

"Disable gcc optimizations for a specific function

Due to a gcc opt bug a piece of code was put in a separate function to
prevent gcc from optimizing it. Later versions of gcc inlined the
function and the bug reappeared. So now we explicitly tell gcc to not
optimize it."

Is it real a GCC bug?

             reply	other threads:[~2022-06-16  8:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16  8:47 zhonghao at pku dot org.cn [this message]
2022-06-16 10:12 ` [Bug c++/105997] " redi at gcc dot gnu.org
2022-06-16 10:14 ` schwab@linux-m68k.org
2022-06-16 10:16 ` redi at gcc dot gnu.org
2022-06-16 10:34 ` redi at gcc dot gnu.org
2022-06-16 10:53 ` redi at gcc dot gnu.org
2022-06-16 10:58 ` pinskia at gcc dot gnu.org

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-105997-4@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).