public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96133] New: x86-64 gcc 10.1 using -O3 leads to wrong calculation
@ 2020-07-09 11:38 heckflosse67 at gmx dot de
  2020-07-09 12:01 ` [Bug c++/96133] [10/11 Regression] x86-64 gcc 10.1 using -O3 leads to wrong calculation since r10-1882-g831e688af50c5f77 marxin at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: heckflosse67 at gmx dot de @ 2020-07-09 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96133
           Summary: x86-64 gcc 10.1 using -O3 leads to wrong calculation
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: heckflosse67 at gmx dot de
  Target Milestone: ---

Here's a simple example which works fine in gcc up to version 9 when build
using -O3
On gcc 10 -O3, the output is different to the output of gcc 10 -O2.
The output of gcc 10 -O2 is the same as of gcc 9.3 -O3 and gcc 9.3 -O2
Using gcc 10 -O3 -fno-tree-loop-vectorize it also works fine.

```
#include <iostream>

constexpr double xyz_sRGB[3][3] = {
    {0.4360747,  0.3850649, 0.1430804},
    {0.2225045,  0.7168786,  0.0606169},
    {0.0139322,  0.0971045,  0.7141733}
};

int main() {
    double rgb_cam[3][3] = {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}, {7.0, 8.0, 9.0}};
    double xyz_cam[3][3] = {{0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}};


    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++)
            for (int k = 0; k < 3; k++) {
                xyz_cam[i][j] += xyz_sRGB[i][k] * rgb_cam[k][j];
            }

        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++) {
                std::cout << xyz_cam[i][j] << std::endl;
            } 
return 0;
}
```

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

end of thread, other threads:[~2020-07-10 11:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 11:38 [Bug c++/96133] New: x86-64 gcc 10.1 using -O3 leads to wrong calculation heckflosse67 at gmx dot de
2020-07-09 12:01 ` [Bug c++/96133] [10/11 Regression] x86-64 gcc 10.1 using -O3 leads to wrong calculation since r10-1882-g831e688af50c5f77 marxin at gcc dot gnu.org
2020-07-09 12:06 ` rguenth at gcc dot gnu.org
2020-07-09 12:06 ` [Bug tree-optimization/96133] " rguenth at gcc dot gnu.org
2020-07-09 12:13 ` rguenth at gcc dot gnu.org
2020-07-09 12:18 ` rguenth at gcc dot gnu.org
2020-07-09 17:54 ` cvs-commit at gcc dot gnu.org
2020-07-09 17:55 ` rguenth at gcc dot gnu.org
2020-07-09 19:33 ` heckflosse67 at gmx dot de
2020-07-10  7:30 ` rguenth at gcc dot gnu.org
2020-07-10  8:53 ` cvs-commit at gcc dot gnu.org
2020-07-10 10:38 ` [Bug tree-optimization/96133] [10 " cvs-commit at gcc dot gnu.org
2020-07-10 10:38 ` rguenth at gcc dot gnu.org
2020-07-10 11:36 ` heckflosse67 at gmx dot de

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).