[Bug c++/115968] g++ 12 and above incorrectly optimize the code with Eigen (-O2 or -O1)
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 17 14:25:23 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115968
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
See C++11 and the auto keyword section of
https://eigen.tuxfamily.org/dox/TopicPitfalls.html
The problem is that eval() returns a temporary object (in this case a MatrixXd)
which is then referenced by the Transpose<> expression. However, this temporary
is deleted right after the first line, and then the C expression references a
dead object.
More information about the Gcc-bugs
mailing list