public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105997] New: A possible optimization bug
@ 2022-06-16  8:47 zhonghao at pku dot org.cn
  2022-06-16 10:12 ` [Bug c++/105997] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zhonghao at pku dot org.cn @ 2022-06-16  8:47 UTC (permalink / raw)
  To: gcc-bugs

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?

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

end of thread, other threads:[~2022-06-16 10:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16  8:47 [Bug c++/105997] New: A possible optimization bug zhonghao at pku dot org.cn
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

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).