public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/111233] New: Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 @ 2023-08-30 7:02 shaohua.li at inf dot ethz.ch 2023-08-30 7:04 ` [Bug tree-optimization/111233] [14 Regression] " pinskia at gcc dot gnu.org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: shaohua.li at inf dot ethz.ch @ 2023-08-30 7:02 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111233 Bug ID: 111233 Summary: Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: shaohua.li at inf dot ethz.ch CC: hubicka at gcc dot gnu.org, jh at suse dot cz Target Milestone: --- gcc at -O3 produces the wrong code. Bisected to r14-2852-gf5fb9ff2396 Compiler explorer: https://godbolt.org/z/vrEMjKr9f $ cat a.c int printf(const char *, ...); int a, c, f; char b, g; int *d = &c; long e; int main() { for (; e != 25; e++) { f = -17; for (; f <= 0; f = f + 7) { g = f ? 0 : b; a = *d; } } printf("%d\n", a);g } $ $ gcc -O2 a.c && ./a.out 0 $ gcc -O3 a.c $ ./a.out (Timeout) $ ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/111233] [14 Regression] Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 2023-08-30 7:02 [Bug c/111233] New: Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 shaohua.li at inf dot ethz.ch @ 2023-08-30 7:04 ` pinskia at gcc dot gnu.org 2023-08-30 7:38 ` xry111 at gcc dot gnu.org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-08-30 7:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111233 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |14.0 Summary|Wrong code at -O3 on |[14 Regression] Wrong code |x86_64-linux-gnu since |at -O3 on x86_64-linux-gnu |r14-2852-gf5fb9ff2396 |since r14-2852-gf5fb9ff2396 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/111233] [14 Regression] Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 2023-08-30 7:02 [Bug c/111233] New: Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 shaohua.li at inf dot ethz.ch 2023-08-30 7:04 ` [Bug tree-optimization/111233] [14 Regression] " pinskia at gcc dot gnu.org @ 2023-08-30 7:38 ` xry111 at gcc dot gnu.org 2023-08-30 7:40 ` shaohua.li at inf dot ethz.ch ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: xry111 at gcc dot gnu.org @ 2023-08-30 7:38 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111233 Xi Ruoyao <xry111 at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xry111 at gcc dot gnu.org --- Comment #1 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- (In reply to Shaohua Li from comment #0) > printf("%d\n", a);g I assume the "g" is a typo? ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/111233] [14 Regression] Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 2023-08-30 7:02 [Bug c/111233] New: Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 shaohua.li at inf dot ethz.ch 2023-08-30 7:04 ` [Bug tree-optimization/111233] [14 Regression] " pinskia at gcc dot gnu.org 2023-08-30 7:38 ` xry111 at gcc dot gnu.org @ 2023-08-30 7:40 ` shaohua.li at inf dot ethz.ch 2023-08-30 8:35 ` rguenth at gcc dot gnu.org ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: shaohua.li at inf dot ethz.ch @ 2023-08-30 7:40 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111233 --- Comment #2 from Shaohua Li <shaohua.li at inf dot ethz.ch> --- (In reply to Xi Ruoyao from comment #1) > (In reply to Shaohua Li from comment #0) > > > printf("%d\n", a);g > > I assume the "g" is a typo? Oh, that's indeed a typo. Sorry for that. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/111233] [14 Regression] Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 2023-08-30 7:02 [Bug c/111233] New: Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 shaohua.li at inf dot ethz.ch ` (2 preceding siblings ...) 2023-08-30 7:40 ` shaohua.li at inf dot ethz.ch @ 2023-08-30 8:35 ` rguenth at gcc dot gnu.org 2023-11-14 14:13 ` cvs-commit at gcc dot gnu.org 2023-11-14 14:16 ` rguenth at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: rguenth at gcc dot gnu.org @ 2023-08-30 8:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111233 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2023-08-30 Priority|P3 |P1 Ever confirmed|0 |1 --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. Also miscompiled with -O2 -fsplit-loops. Note enabling -fsplit-loops yields t.c: In function 'main': t.c:9:26: warning: iteration 3 invokes undefined behavior [-Waggressive-loop-optimizations] 9 | for (; f <= 0; f = f + 7) { | ~~^~~ t.c:9:14: note: within this loop 9 | for (; f <= 0; f = f + 7) { | ~~^~~~ when this happens we usually end up with an endless loop. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/111233] [14 Regression] Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 2023-08-30 7:02 [Bug c/111233] New: Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 shaohua.li at inf dot ethz.ch ` (3 preceding siblings ...) 2023-08-30 8:35 ` rguenth at gcc dot gnu.org @ 2023-11-14 14:13 ` cvs-commit at gcc dot gnu.org 2023-11-14 14:16 ` rguenth at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-11-14 14:13 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111233 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:2066c29bf8dea87c9810eb261e342d941a6b2059 commit r14-5446-g2066c29bf8dea87c9810eb261e342d941a6b2059 Author: Richard Biener <rguenther@suse.de> Date: Tue Nov 14 14:26:17 2023 +0100 tree-optimization/111233 - loop splitting miscompile The change in r14-2852-gf5fb9ff2396fd4 failed to update patch_loop_exit to compensate for rewriting of a NE/EQ_EXPR to a new code. Fixed with the following. PR tree-optimization/111233 PR tree-optimization/111652 PR tree-optimization/111727 PR tree-optimization/111838 PR tree-optimization/112113 * tree-ssa-loop-split.cc (patch_loop_exit): Get the new guard code instead of the old guard stmt. (split_loop): Adjust. * gcc.dg/torture/pr111233.c: New testcase. * gcc.dg/torture/pr111652.c: Likewise. * gcc.dg/torture/pr111727.c: Likewise. * gcc.dg/torture/pr111838.c: Likewise. * gcc.dg/torture/pr112113.c: Likewise. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/111233] [14 Regression] Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 2023-08-30 7:02 [Bug c/111233] New: Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 shaohua.li at inf dot ethz.ch ` (4 preceding siblings ...) 2023-11-14 14:13 ` cvs-commit at gcc dot gnu.org @ 2023-11-14 14:16 ` rguenth at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: rguenth at gcc dot gnu.org @ 2023-11-14 14:16 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111233 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Fixed. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-11-14 14:16 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-08-30 7:02 [Bug c/111233] New: Wrong code at -O3 on x86_64-linux-gnu since r14-2852-gf5fb9ff2396 shaohua.li at inf dot ethz.ch 2023-08-30 7:04 ` [Bug tree-optimization/111233] [14 Regression] " pinskia at gcc dot gnu.org 2023-08-30 7:38 ` xry111 at gcc dot gnu.org 2023-08-30 7:40 ` shaohua.li at inf dot ethz.ch 2023-08-30 8:35 ` rguenth at gcc dot gnu.org 2023-11-14 14:13 ` cvs-commit at gcc dot gnu.org 2023-11-14 14:16 ` rguenth 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).