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

            Bug ID: 101634
           Summary: Vectorize optimisations trigger floating point
                    exception
           Product: gcc
           Version: 11.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at wdqb dot uk
  Target Milestone: ---

Created attachment 51208
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51208&action=edit
Code that reproduces the issue

I am using g++ 11.1.1 on OpenSUSE Tumbleweed 20210713.

When compiled with `g++ -O3 example.cpp` the code snippet triggers a floating
point exception and the program exits through the `signalHandler` function. I
believe this behaviour to be incorrect.

When compiled with `g++ -O3 -fno-tree-slp-vectorize example.cpp` (or any lower
level of optimisation) the exception is not triggered and the program exits
normally.

When compiled with any older version of `g++` with `O3` the exception is not
triggered and the program exits normally.

The program can also be modified to read it's input values from a file (see
commented section). This is shown to prove that the optimisation is not
dependent on the values being available at compile time. Indeed, this is a
snippet of a larger program in which the values are read in from a file.

Reply via email to