http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52943

             Bug #: 52943
           Summary: likely wrong code bug
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: reg...@cs.utah.edu
                CC: cheny...@cs.utah.edu


[regehr@dyson r23]$ current-gcc -O2 small.c ; ./a.out 
0
[regehr@dyson r23]$ current-gcc -O3 small.c ; ./a.out 
1
[regehr@dyson r23]$ cat small.c
int printf (const char *, ...);
int a[] = { 0, 0, 0, 6 };

int b;
int
main ()
{
    for (;;)
    {
        b = 3;
        for (; b; b -= 1)
            a[b] = a[3] > 1;
        break;
    }
    printf ("%d\n", a[1]);
    return 0;
}


[regehr@dyson r23]$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r186359-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r186359-install
--program-prefix=r186359- --enable-languages=c,c++
Thread model: posix
gcc version 4.8.0 20120411 (experimental) (GCC)

Reply via email to