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?