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

            Bug ID: 79088
           Summary: wrong code at -O2 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: ---

It seems to be a recent regression. 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20170113 (experimental) [trunk revision 244397] (GCC) 
$ 
$ gcc-trunk -Os small.c
$ ./a.out
$ 
$ gcc-trunk -O2 small.c
$ timeout -s 9 5 ./a.out
Killed
$ 


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


int a, b, c, d, e = 1;

int main ()
{
  int f;
  if (a)
    goto L;
  for (f = 0; f < e; e++)
    {
    L:
      if (d)
        continue;
      if (c)
        goto L;
      for (a = 0; a < 6; a++)
        for (f = 0; f < 3; f++)
          while (b)
            c++;
    }
  return 0;
}

Reply via email to