public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/110141] New: Wrong code at -O2 on x86_64-linux-gnu
@ 2023-06-06 12:00 shaohua.li at inf dot ethz.ch
2023-06-06 17:32 ` [Bug middle-end/110141] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-06-06 12:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110141
Bug ID: 110141
Summary: Wrong code at -O2 on x86_64-linux-gnu
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
Target Milestone: ---
For the following code, gcc since 12 emits the wrong code at -O2.
Compiler explorer: https://godbolt.org/z/reGo6jqGK
$ cat a.c
int printf(const char *, ...);
int h, i = 1, m;
int *j = &i, *k = &i, *l;
short n(short b, short c, int d) {
short e[] = {71, c, c, 40, 28, 57, 3, 8, 79, 19, c};
int f = d, a = b;
short *g = e;
while (f > 1) {
a += *g++;
f -= 2;
}
a += *g -= 255;
return a;
}
int fn2() {
h = 0;
for (;; h = 5) {
int o[4];
m = 0;
for (; m < 4; m++)
o[n(6, 7, 19) - 70 + m] = 6;
if (h) {
for (;;) {
int p = 0;
if (*k)
break;
l = &p;
}
*j = o[0];
return 0;
}
}
}
int main() {
fn2();
printf("%d\n", i);
}
$
$ gcc-tk -O0 a.c && ./a.out
6
$ gcc-tk -O2 a.c && ./a.out
0
$
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/110141] Wrong code at -O2 on x86_64-linux-gnu
2023-06-06 12:00 [Bug c/110141] New: Wrong code at -O2 on x86_64-linux-gnu shaohua.li at inf dot ethz.ch
@ 2023-06-06 17:32 ` pinskia at gcc dot gnu.org
2023-07-30 14:28 ` shaohua.li at inf dot ethz.ch
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-06 17:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110141
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Another -fstack-reuse= issue.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/110141] Wrong code at -O2 on x86_64-linux-gnu
2023-06-06 12:00 [Bug c/110141] New: Wrong code at -O2 on x86_64-linux-gnu shaohua.li at inf dot ethz.ch
2023-06-06 17:32 ` [Bug middle-end/110141] " pinskia at gcc dot gnu.org
@ 2023-07-30 14:28 ` shaohua.li at inf dot ethz.ch
2023-12-17 23:14 ` [Bug middle-end/110141] [12/13/14 Regression] " pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-07-30 14:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110141
--- Comment #2 from Shaohua Li <shaohua.li at inf dot ethz.ch> ---
I tried to bisect this case and I bisected it to r12-4790-g4b3a325f07a
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/110141] [12/13/14 Regression] Wrong code at -O2 on x86_64-linux-gnu
2023-06-06 12:00 [Bug c/110141] New: Wrong code at -O2 on x86_64-linux-gnu shaohua.li at inf dot ethz.ch
2023-06-06 17:32 ` [Bug middle-end/110141] " pinskia at gcc dot gnu.org
2023-07-30 14:28 ` shaohua.li at inf dot ethz.ch
@ 2023-12-17 23:14 ` pinskia at gcc dot gnu.org
2024-03-08 15:35 ` law at gcc dot gnu.org
2024-03-12 13:24 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-17 23:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110141
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Wrong code at -O2 on |[12/13/14 Regression] Wrong
|x86_64-linux-gnu |code at -O2 on
| |x86_64-linux-gnu
Ever confirmed|0 |1
Last reconfirmed| |2023-12-17
Target Milestone|--- |12.4
Status|UNCONFIRMED |NEW
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/110141] [12/13/14 Regression] Wrong code at -O2 on x86_64-linux-gnu
2023-06-06 12:00 [Bug c/110141] New: Wrong code at -O2 on x86_64-linux-gnu shaohua.li at inf dot ethz.ch
` (2 preceding siblings ...)
2023-12-17 23:14 ` [Bug middle-end/110141] [12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2024-03-08 15:35 ` law at gcc dot gnu.org
2024-03-12 13:24 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-08 15:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110141
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
CC| |law at gcc dot gnu.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/110141] [12/13/14 Regression] Wrong code at -O2 on x86_64-linux-gnu
2023-06-06 12:00 [Bug c/110141] New: Wrong code at -O2 on x86_64-linux-gnu shaohua.li at inf dot ethz.ch
` (3 preceding siblings ...)
2024-03-08 15:35 ` law at gcc dot gnu.org
@ 2024-03-12 13:24 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-12 13:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110141
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Priority|P1 |P2
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 12-13 has been released with this bug, so P2.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-12 13:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06 12:00 [Bug c/110141] New: Wrong code at -O2 on x86_64-linux-gnu shaohua.li at inf dot ethz.ch
2023-06-06 17:32 ` [Bug middle-end/110141] " pinskia at gcc dot gnu.org
2023-07-30 14:28 ` shaohua.li at inf dot ethz.ch
2023-12-17 23:14 ` [Bug middle-end/110141] [12/13/14 Regression] " pinskia at gcc dot gnu.org
2024-03-08 15:35 ` law at gcc dot gnu.org
2024-03-12 13:24 ` jakub 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).