[Bug c++/70222] New: Test miscompiled with -O1

vsevolod.livinskij at frtk dot ru gcc-bugzilla@gcc.gnu.org
Mon Mar 14 09:16:00 GMT 2016


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

            Bug ID: 70222
           Summary: Test miscompiled with -O1
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vsevolod.livinskij at frtk dot ru
  Target Milestone: ---

Created attachment 37954
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37954&action=edit
Reproducer.

Test case produces incorrect result starting with -O1 optimization level. Test
case fails with -march=nehalem, haswell, knl and skylake-avx512 options and
with gcc version 4.8.5 (Revision=226194), gcc version 4.9.4 20160311
(prerelease) (Revision=234148) and gcc version 5.3.1 20160311
(Revision=234148).

Output:
>  g++ repr.cpp -o out -O1 -march=haswell; ./out
-262143
>  g++ repr.cpp -o out -O0 -march=haswell; ./out
-1

GCC version:
> g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/export/users/vlivinsk/gcc-trunk/bin/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /export/users/vlivinsk/gcc-trunk/gcc/configure
--with-arch=corei7 --with-cpu=corei7 --enable-clocale=gnu --with-system-zlib
--enable-shared --with-demangler-in-ld --enable-cloog-backend=isl
--with-fpmath=sse --enable-checking=release --enable-languages=c,c++,lto
--with-gmp=/export/users/vlivinsk/gcc-trunk/gmp-6.1.0/bin
--with-mpfr=/export/users/vlivinsk/gcc-trunk/mpfr-3.1.3/bin
--with-mpc=/export/users/vlivinsk/gcc-trunk/mpc-1.0.3/bin
--prefix=/export/users/vlivinsk/gcc-trunk/bin
Thread model: posix
gcc version 6.0.0 20160314 (experimental) (Revision=234175)


More information about the Gcc-bugs mailing list