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

            Bug ID: 115968
           Summary: g++ 12 and above incorrectly optimize the code with
                    Eigen (-O2 or -O1)
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: summersnow9403 at gmail dot com
  Target Milestone: ---

The code example can be found on godbolt:

https://godbolt.org/z/qPs4zhb3j

The two functions test_eigen and test_eigen2 are expected to output the same
result. However, when compiled with gcc 12 and above versions with -O2, the
program prints all zeros for test_eigen. When compiled with gcc 12 and above
without -O2, or any versions of clang with -O2, the program behaves correctly.

Reply via email to