This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52406] New: likely wrong code bug
- From: "regehr at cs dot utah.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 27 Feb 2012 18:14:23 +0000
- Subject: [Bug c/52406] New: likely wrong code bug
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52406
Bug #: 52406
Summary: likely wrong code bug
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: regehr@cs.utah.edu
regehr@john-home:~/z/reduce/1$ current-gcc -O2 small.c ; ./a.out
1
regehr@john-home:~/z/reduce/1$ current-gcc -O3 small.c ; ./a.out
0
regehr@john-home:~/z/reduce/1$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r184581-install/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r184581-install
--program-prefix=r184581- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20120226 (experimental) (GCC)
regehr@john-home:~/z/reduce/1$ cat small.c
int printf (const char *, ...);
struct
{
int f1;
} a[2];
int *b, *const k = &a[1].f1;
static int **c = &b;
int e, f, d;
int main ()
{
int **l = &b;
*l = k;
for ( ; d <= 0; d++ )
{
int *j = &e;
**c = 1;
*l = k;
*k ^= 0;
f = **l;
*j = f;
}
printf ( "%d\n", e );
return 0;
}