https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82574

            Bug ID: 82574
           Summary: wrong code at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

This seems to be a recent regression. 

$ gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20171016 (experimental) [trunk revision 253793] (GCC) 
$ 
$ gcctk -O2 small.c; ./a.out; echo $?
0
$ gcc-7.2.0 -O3 small.c; ./a.out; echo $?
0
$ 
$ gcctk -O3 small.c; ./a.out; echo $?
1
$ 


-------------------------------


char a, b, c, d[2][3];

int main ()
{
  for (; a < 2; a++)
    for (b = 0; b < 3; b++)
      if (c)
        d[a][b] = 1;
  return d[0][0]; 
}

Reply via email to