This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/78856] New: wrong code at -O3 on x86_64-linux-gnu (in both 32-bit and 64-bit modes)


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

            Bug ID: 78856
           Summary: wrong code at -O3 on x86_64-linux-gnu (in both 32-bit
                    and 64-bit modes)
           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 affects 6.x and later, and is a regression from 5.x. 

$ 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 20161218 (experimental) [trunk revision 243783] (GCC) 
$ 
$ gcc-trunk -O2 small.c; ./a.out
$ gcc-5.4 -O3 small.c; ./a.out
$ 
$ gcc-trunk -O3 small.c
$ timeout -s 9 5 ./a.out
Killed
$ 


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


int a, b, c, d, e, f[3]; 

int main() 
{
  while (d)
    while (1)
      ;
  int g = 0, h, i = 0;
  for (; g < 21; g += 9) 
    {
      int j = 1;
      for (h = 0; h < 3; h++)
        f[h] = 1;
      for (; j < 10; j++) {
        d = i && (b ? 0 : c); 
        i = 1;
        if (g)
          a = e;
      }
  }
  return 0;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]