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

            Bug ID: 87046
           Summary: Incorrect vectorization of fma with -O3
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yates at cscs dot ch
  Target Milestone: ---

Created attachment 44569
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44569&action=edit
Stripped preprocessed source of minimal test case.

In some circumstances, vectorization of fma at -O3 on broadwell and haswell
incorrectly uses the wrong data for the addition component. While the sample
code was tested with gcc version 7.3.0 with -march=haswell, the same problem
arises with gcc 6.4.0.

Disabling tree-slp-vectorize restores correct behaviour. 

I've attached a stripped down preprocessed source that demonstrates the bug.

gcc -v output:

Using built-in specs.
COLLECT_GCC=/opt/gcc/7.3.0/bin/../snos/bin/gcc
COLLECT_LTO_WRAPPER=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../cray-gcc-7.3.0-201801270210.d61239fc6000b/configure
--prefix=/opt/gcc/7.3.0/snos --disable-nls --libdir=/opt/gcc/7.3.0/snos/lib
--enable-languages=c,c++,fortran
--with-gxx-include-dir=/opt/gcc/7.3.0/snos/include/g++
--with-slibdir=/opt/gcc/7.3.0/snos/lib --with-system-zlib --enable-shared
--enable-__cxa_atexit --build=x86_64-suse-linux --with-ppl --with-cloog
--disable-multilib
Thread model: posix
gcc version 7.3.0 20180125 (Cray Inc.) (GCC) 

Compilation command line and program output:

$ gcc -O3 -march=haswell fma-reduced-bug.i 
$ ./a.out 
Aborted (core dumped)

Reply via email to