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

            Bug ID: 116272
           Summary: [13/14/15 Regression] Wrong code at -O2/3/s on
                    aarch64-linux-gnu
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jwzeng at nuaa dot edu.cn
  Target Milestone: ---

The following code snippet, gcc at -O2/3/s produces the wrong code.

```
$ cat test.c
int printf(const char *, ...);
float a = 1 + 0x1p-23, b = 1 - 0x1p-23, c = -1;
int main() {
  float p = a * b, d = p + c;
  if (d)
    printf("1\n");
}
$ gcc-trunk test.c -O0; ./a.out
$ gcc-trunk test.c -O1; ./a.out
$ gcc-trunk test.c -O2; ./a.out
1
$ gcc-trunk test.c -O3; ./a.out
1
$ gcc-trunk test.c -Os; ./a.out
1
$
$ gcc-13 test.c -O2; ./a.out
1
$
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=/root/compilers/gcc/gcc-trunk-20240807/bin/gcc
COLLECT_LTO_WRAPPER=/root/compilers/gcc/gcc-trunk-20240807/libexec/gcc/aarch64-unknown-linux-gnu/15.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: ./configure --disable-multilib --enable-languages=c,c++
--disable-bootstrap --disable-libgomp --enable-checking=no --disable-checking
--disable-decimal-float --prefix=/root/compilers/gcc/gcc-trunk-20240807
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240807 (experimental) (GCC)
$
$ gcc-13 -v
Using built-in specs.
COLLECT_GCC=gcc-13
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-linux-gnu/13/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
13.1.0-8ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust --prefix=/usr
--with-gcc-major-version-only --program-suffix=-13
--program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support
--enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419
--disable-werror --enable-checking=release --build=aarch64-linux-gnu
--host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (Ubuntu 13.1.0-8ubuntu1~18.04)
```

Reply via email to