[Bug tree-optimization/112721] New: [14 Regression] Wrong code at -O1/s on x86_64-linux-gnu since r14-5831-gaae723d360c
shaohua.li at inf dot ethz.ch
gcc-bugzilla@gcc.gnu.org
Mon Nov 27 08:04:21 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112721
Bug ID: 112721
Summary: [14 Regression] Wrong code at -O1/s on
x86_64-linux-gnu since r14-5831-gaae723d360c
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: shaohua.li at inf dot ethz.ch
CC: mjambor at suse dot cz
Target Milestone: ---
gcc at -O1/s produces the wrong code.
Bisected to r14-5831-gaae723d360c
Compiler explorer: https://godbolt.org/z/671M9YPPj
$ cat a.c
int printf(const char *, ...);
struct a {
int b;
};
int c, e;
long d;
unsigned *f(unsigned *g) {
for (; c;)
e = d;
return g;
}
int main() {
int *h;
struct a i = {8};
int *j = &i.b;
h = f(j);
*h = 0;
printf("%d\n", i.b);
}
$
$ gcc -O0 a.c && ./a.out
0
$ gcc -O1 a.c && ./a.out
8
$
More information about the Gcc-bugs
mailing list