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
* [Bug c++/105997] A possible optimization bug 2022-06-16 8:47 [Bug c++/105997] New: A possible optimization bug zhonghao at pku dot org.cn @ 2022-06-16 10:12 ` redi at gcc dot gnu.org 2022-06-16 10:14 ` schwab@linux-m68k.org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2022-06-16 10:12 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105997 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is not a valid bug report. https://gcc.gnu.org/bugs ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105997] A possible optimization bug 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 ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: schwab@linux-m68k.org @ 2022-06-16 10:14 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105997 --- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> --- This line is definitely a bug in ZynAddSubFX: 1154: bool is_dir = fn->d_type & DT_DIR; d_type is not a bitfield. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105997] A possible optimization bug 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 ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2022-06-16 10:16 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105997 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- If anybody wants to turn it into a proper bug report, the original commit (and description) is at https://github.com/zynaddsubfx/zynaddsubfx/commit/22a5f8da76c16c47c3814eedaec8f9fe0ff4248b ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105997] A possible optimization bug 2022-06-16 8:47 [Bug c++/105997] New: A possible optimization bug zhonghao at pku dot org.cn ` (2 preceding siblings ...) 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 5 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2022-06-16 10:34 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105997 --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Andreas Schwab from comment #2) > This line is definitely a bug in ZynAddSubFX: > > 1154: bool is_dir = fn->d_type & DT_DIR; > > d_type is not a bitfield. Not all systems even have a dirent::d_type field (POSIX doesn't require it). ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105997] A possible optimization bug 2022-06-16 8:47 [Bug c++/105997] New: A possible optimization bug zhonghao at pku dot org.cn ` (3 preceding siblings ...) 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 5 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2022-06-16 10:53 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105997 --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #3) > If anybody wants to turn it into a proper bug report, the original commit > (and description) is at > https://github.com/zynaddsubfx/zynaddsubfx/commit/ > 22a5f8da76c16c47c3814eedaec8f9fe0ff4248b "Symptoms of the failed optimization include a partial copy of values with some corrupted or turned into null pointers." Sounds likely to be a lifetime issue with the std::string values e.g. trying to read them after the containing vector has been destroyed. But somebody has to provide a proper bug report to be sure. Please stop opening bug reports that are just a link to comments in github. If you want to investigate them yourself, great. But "Somebody said GCC broke their code" is not a valid bug report. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105997] A possible optimization bug 2022-06-16 8:47 [Bug c++/105997] New: A possible optimization bug zhonghao at pku dot org.cn ` (4 preceding siblings ...) 2022-06-16 10:53 ` redi at gcc dot gnu.org @ 2022-06-16 10:58 ` pinskia at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-06-16 10:58 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105997 --- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Also people who assume the compiler is broken ask them to try -fsanitize=address and other sanitizers really. Gcc does is more "sensitive" to undefined behavior and more bugs in the user code does happen. ^ 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).