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

chengniansun at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 29 06:13:00 GMT 2016


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

            Bug ID: 71691
           Summary: wrong code at -O3 in both 32-bit and 64-bit modes on
                    x86_64-linux-gnu (Floating point exception)
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ 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 20160628 (experimental) [trunk revision 237830] (GCC) 
$ 
$ gcc-trunk -O3 -m32 small.c ; ./a.out
Floating point exception (core dumped)
$ 
$ gcc-trunk -O3 -m64 small.c ; ./a.out
Floating point exception (core dumped)
$ 
$ gcc-trunk -O2 -m64 small.c ; ./a.out
$ 
$ cat small.c
char b;
short f;
unsigned e;
int g = 20;
void fn1() {
  int l = 0;
  for (; l <= 7; l++) {
    int h, j = 38;
    if (g)
      h = 0;
    for (; h <= 7; h++) {
      int i, k = b % (j % 4);
      g = f;
      for (;;) {
        j = 6 || b;
        if (e) {
          for (; j; --j)
            if (k)
              __builtin_printf("%d", 9);
          if (i)
            __builtin_printf("%d", j);
        }
        if (l)
          continue;
        break;
      }
      i = f || b; 
    }
  }
}

int main() { 
  fn1(); 
  return 0;
}
$


More information about the Gcc-bugs mailing list