public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110182] New: GCC generates incorrect results for simple Eigen Casts / Subtractions at -O2 or above for a 3 dimensional vector
@ 2023-06-08 20:48 lakin at vividtheory dot com
  2023-06-08 21:00 ` [Bug target/110182] Vector(2) cast from double to float and subtraction seems to produce incorrect results at -O2 and above pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: lakin at vividtheory dot com @ 2023-06-08 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110182
           Summary: GCC generates incorrect results for simple Eigen Casts
                    / Subtractions at -O2 or above for a 3 dimensional
                    vector
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lakin at vividtheory dot com
  Target Milestone: ---

Created attachment 55286
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55286&action=edit
The minimal reproducing example

I am attaching a simple example program that shows how gcc is getting an
incorrect result for a simple program which is attempting to represent a 1D
matrix of doubles as two floating point matrices, one for the closest value as
a float and one for the remainder.  

gcc 11 gets correct results at -O1 and -O2, but not -O3. gcc 12/13 get
incorrect results at -O2 and -O3, but not at -O1.

I've attached the source file below, and am more than happy to provide more
information / intermediate outputs. However, one can reproduce this even at
godbolt: https://godbolt.org/z/j7P5of7xo 

More info here:
https://gist.github.com/lakinwecker/9ef9dbde94c018a33f4c33822c6d93ad

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-12-15 12:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 20:48 [Bug c++/110182] New: GCC generates incorrect results for simple Eigen Casts / Subtractions at -O2 or above for a 3 dimensional vector lakin at vividtheory dot com
2023-06-08 21:00 ` [Bug target/110182] Vector(2) cast from double to float and subtraction seems to produce incorrect results at -O2 and above pinskia at gcc dot gnu.org
2023-06-08 21:01 ` pinskia at gcc dot gnu.org
2023-06-08 21:03 ` [Bug target/110182] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-06-08 21:17 ` [Bug tree-optimization/110182] " pinskia at gcc dot gnu.org
2023-06-09  7:16 ` [Bug tree-optimization/110182] [11/12/13/14 Regression] Vector(2) cast from double to float and back and subtraction seems to produce incorrect results rguenth at gcc dot gnu.org
2023-06-09  9:08 ` rguenth at gcc dot gnu.org
2023-06-09 10:10 ` [Bug tree-optimization/110182] [11/12 " rguenth at gcc dot gnu.org
2023-06-23 11:30 ` cvs-commit at gcc dot gnu.org
2023-12-15 12:22 ` [Bug tree-optimization/110182] [11 " rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).