public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug tree-optimization/104521] New: wrong code at -O2 and -O3 on x86_64-linux-gnu @ 2022-02-13 17:59 zhendong.su at inf dot ethz.ch 2022-02-13 18:00 ` [Bug tree-optimization/104521] " zhendong.su at inf dot ethz.ch ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: zhendong.su at inf dot ethz.ch @ 2022-02-13 17:59 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104521 Bug ID: 104521 Summary: wrong code at -O2 and -O3 on x86_64-linux-gnu Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch Target Milestone: --- It appears to be a recent regression and is very likely related to PR 104519. But opposite to PR 104519, it doesn't reproduce at -Os, and instead reproduces at -O2 and -O3. At -Os, there is a spurious UB warning though. [611] % gcctk -v Using built-in specs. COLLECT_GCC=gcctk COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib --with-system-zlib Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.1 20220213 (experimental) [master r12-7216-g7e204bd2f18] (GCC) [612] % [612] % gcctk -Os small.c; ./a.out small.c: In function ‘main’: small.c:6:30: warning: iteration 42 invokes undefined behavior [-Waggressive-loop-optimizations] 6 | for (c = 0; c != -4; c -= 3) { | ^~ small.c:6:21: note: within this loop 6 | for (c = 0; c != -4; c -= 3) { | ~~^~~~~ [613] % [613] % gcctk -O2 small.c [614] % timeout -s 9 5 ./a.out Killed [615] % [615] % cat small.c char a, b, c; int main() { unsigned char d = 1; while (1) { if (c >= a) { for (c = 0; c != -4; c -= 3) { while (!d) b = 0; continue; } } d = ~a; if (!d) continue; return 0; } } ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/104521] wrong code at -O2 and -O3 on x86_64-linux-gnu 2022-02-13 17:59 [Bug tree-optimization/104521] New: wrong code at -O2 and -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch @ 2022-02-13 18:00 ` zhendong.su at inf dot ethz.ch 2022-02-13 22:29 ` [Bug tree-optimization/104521] [12 Regression] wrong code at -O2 and -O3 with char as loop induction variable pinskia at gcc dot gnu.org 2022-02-13 22:30 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: zhendong.su at inf dot ethz.ch @ 2022-02-13 18:00 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104521 --- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> --- >From Compiler Explorer: https://godbolt.org/z/Y37Wo9e8c ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/104521] [12 Regression] wrong code at -O2 and -O3 with char as loop induction variable 2022-02-13 17:59 [Bug tree-optimization/104521] New: wrong code at -O2 and -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch 2022-02-13 18:00 ` [Bug tree-optimization/104521] " zhendong.su at inf dot ethz.ch @ 2022-02-13 22:29 ` pinskia at gcc dot gnu.org 2022-02-13 22:30 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-02-13 22:29 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104521 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|wrong code at -O2 and -O3 |[12 Regression] wrong code |on x86_64-linux-gnu |at -O2 and -O3 with char as | |loop induction variable Target Milestone|--- |12.0 Known to work| |11.2.0 Known to fail| |12.0 Keywords| |diagnostic, wrong-code --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I suspect it was introduced by r12-6844-gf1af8528d3 . ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/104521] [12 Regression] wrong code at -O2 and -O3 with char as loop induction variable 2022-02-13 17:59 [Bug tree-optimization/104521] New: wrong code at -O2 and -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch 2022-02-13 18:00 ` [Bug tree-optimization/104521] " zhendong.su at inf dot ethz.ch 2022-02-13 22:29 ` [Bug tree-optimization/104521] [12 Regression] wrong code at -O2 and -O3 with char as loop induction variable pinskia at gcc dot gnu.org @ 2022-02-13 22:30 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-02-13 22:30 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104521 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Dup of bug 104519. *** This bug has been marked as a duplicate of bug 104519 *** ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-13 22:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-02-13 17:59 [Bug tree-optimization/104521] New: wrong code at -O2 and -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch 2022-02-13 18:00 ` [Bug tree-optimization/104521] " zhendong.su at inf dot ethz.ch 2022-02-13 22:29 ` [Bug tree-optimization/104521] [12 Regression] wrong code at -O2 and -O3 with char as loop induction variable pinskia at gcc dot gnu.org 2022-02-13 22:30 ` 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).