[Bug tree-optimization/87147] New: GCC miscompiles at -O3 on valid code

helloqirun at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 29 21:22:00 GMT 2018


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

            Bug ID: 87147
           Summary: GCC miscompiles at -O3 on valid code
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

It miscompiles after r263959. Bisect points to r263875.



$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 9.0.0 20180829 (experimental) [trunk revision 263965] (GCC)


$ gcc-trunk  abc.c  ; ./a.out
$ gcc-trunk -O3 abc.c ; timeout -s 9 10 ./a.out
Killed


$ cat abc.c
short a;
long b;
int c, d, g;
char e, h;
long f[] = {0};
int main() {
  int i = 1;
  for (; a <= 3; a++) {
    c = 0;
    for (; c <= 2; c++) {
      b = 0;
      for (; b <= 3; b++) {
        h = i && f[d];
        e = g && i;
        i = 0;
      }
    }
  }
}


More information about the Gcc-bugs mailing list