https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70021
Bug ID: 70021 Summary: Test miscompiled with -O3 option for -march=core-avx2. 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 37826 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37826&action=edit Reproducer. Test case produces incorrect result with -O3 option for -march=core-avx2. Everything works fine with other march (-march=corei7-avx and -march=knl). Also gcc version 4.9.4 (Revision=233763) and gcc version 5.3.1 (Revision=233763) generate correct code. Output: > g++ small.cpp -o out -O3 -std=c++11 -march=core-avx2; ./out 13370567410841507191 > g++ small.cpp -o out -O2 -std=c++11 -march=core-avx2; ./out 16372995556503316667 GCC version: > g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/gcc-trunk/bin/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../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 --with-pkgversion=Revision=233809 --enable-languages=c,c++,lto --with-gmp=/gcc-trunk/gmp-6.1.0/bin --with-mpfr=/gcc-trunk/mpfr-3.1.3/bin --with-mpc=/gcc-trunk/mpc-1.0.3/bin --prefix=/gcc-trunk/bin Thread model: posix gcc version 6.0.0 20160229 (experimental) (Revision=233809)