[Bug tree-optimization/107269] wrong code at -O1 and above with "-fno-tree-ccp" on x86_64-linux-gnu

zhendong.su at inf dot ethz.ch gcc-bugzilla@gcc.gnu.org
Sat Oct 15 20:45:31 GMT 2022


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

--- Comment #2 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Another related instance:

[642] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221015 (experimental) [master r13-3311-gbaeec7cc83b] (GCC)
[643] %
[643] % gcctk -O1 small.c; ./a.out
[644] %
[644] % gcctk -O1 -fno-tree-ccp small.c
[645] % ./a.out
Aborted
[646] %
[646] % cat small.c
char a;
unsigned b;
int d = 39381789, e, f, g = 1;
long h, i;
int main() {
  int j = 38;
  long k = 1;
  for (; e < 8; e++)
    if (k)
      while (1) {
        int l = j * h;
        char m = j;
        if (g)
          m = a;
        f = j;
        b = d;
        j = d = b * f;
        if (d < 665)
          break;
        if (f > d)
          k = m;
        long n = ~(b - i);
        i = ~h;
        if (b <= 46295405)
          break;
        h = n;
        int *c = &j;
        if (i > 10843)
          __builtin_abort();
      }
  return 0;
}


More information about the Gcc-bugs mailing list