http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58320
Bug ID: 58320
Summary: [4.7 / 4.8 / 4.9 Regression] code used in autoconf
test fails with -O2, works with -O0
Product: gcc
Version: 4.7.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: doko at gcc dot gnu.org
seen on arm-linux-gnueabihf, as part of an autoconf test in librep:
$ cat stack.c
#include <stdlib.h>
void inner (char *foo) {
char bar;
exit (!(foo >= &bar));
}
void main () {
char foo;
inner (&foo);
}
$ gcc-4.6 -o conftest -O2 stack.c && ./conftest ; echo $?
0
$ gcc-4.7 -o conftest -O2 stack.c && ./conftest ; echo $?
1
$ gcc-4.8 -o conftest -O2 stack.c && ./conftest ; echo $?
1
$ gcc-4.8 -o conftest -O0 stack.c && ./conftest ; echo $?
0