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

            Bug ID: 93734
           Summary: Invalid code generated with -O2 -march=haswell
                    -ftree-vectorize
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bartoldeman at users dot sourceforge.net
  Target Milestone: ---

Created attachment 47837
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47837&action=edit
Fortran code that prints 0 if correct, and -9 if miscompiled

The attached code prints -9.0000000000000000 if compiled using

gfortran -O2 -march=haswell -ftree-vectorize bug.f90 -o bug
./bug
  -9.0000000000000000
using
GNU Fortran (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

also reproduceable on GCC 9.2.0, but not with GCC 7.3.0 and earlier.

The correct answer is 1-1=0.

(I found this issue first when compiling the reference BLAS using those options
and running the "zblat2" tests, the test is a much reduced version of ztrsv,
see
http://www.netlib.org/lapack/explore-html/dc/dc1/group__complex16__blas__level2_ga99cc66f0833474d6607e6ea7dbe2f9bd.html#ga99cc66f0833474d6607e6ea7dbe2f9bd)

Reply via email to