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

            Bug ID: 84616
           Summary: funsafe-math-optimizations leads to incorrect results
                    for 4x4 matrix inversion
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michael at moekadu dot de
  Target Milestone: ---

Created attachment 43530
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43530&action=edit
Example code for inversion of 4x4 identity matrix

Trying to do a matrix inversion from the Eigen3-library leads wrong results
when compiling with the -funsafe-math-optimizations -O1.

When inverting the identity matrix I would expect as result:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
----
Instead I get the result
1  0  0  0
0 -1  0  0
0  0  1  0
0  0  0 -1
----
Compiler version: gcc7.3
CPU: Intel(R) Xeon(R) CPU E3-1276 v3 @ 3.60GHz
Eigen library version: 3.3.4

Reply via email to