[Bug target/57608] New: wrong code for expression at -O3 on x86_64-linux-gnu with -m32
dhazeghi at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Thu Jun 13 21:07:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57608
Bug ID: 57608
Summary: wrong code for expression at -O3 on x86_64-linux-gnu
with -m32
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: dhazeghi at yahoo dot com
Current gcc trunk and 4.8.x produces wrong code for the following testcase on
x86_64-linux when compiled at -O3 in 32-bit mode. This is a regression from
4.7.x.
$ gcc-trunk -v
gcc version 4.9.0 20130613 (experimental) [trunk revision 200065] (GCC)
$ gcc-trunk -O2 -m32 wrong.c
$ ./a.out
2
$ gcc-4.7 -O3 -m32 wrong.c
$ ./a.out
2
$ gcc-trunk -O3 -m32 wrong.c
$ ./a.out
3
$
----------------------------------
int printf(const char *, ...);
int a, b, d, e, *f = &b;
long long l, *pl = &l;
char c, *pc = &c;
int bar(int r, long long s) {
b++;
a = 0;
if (b) {
b = r + s;
b++;
return c;
}
{
int arr[] = {};
return 0;
}
}
void foo(int j) {
int k;
for (; j != 5; ++j) {
*pc = *f;
for (; e != 1; e++) {
*pl = 0;
{
int i = 0;
for (; i < 1; i++)
a = 0;
}
k = bar(d, 1);
d = bar(1, k);
}
}
}
void baz() { foo(0); }
int main() {
foo(0);
printf("%d\n", c);
return 0;
}
More information about the Gcc-bugs
mailing list