From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2B047386197E; Thu, 9 Jul 2020 11:38:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B047386197E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594294704; bh=0PrEIeOFJNMxNEuLtZGMLphwisrPS7i0mzcXmyySR14=; h=From:To:Subject:Date:From; b=qAPa4NI9V5BBCFskl4y1oXzobCb1Vtpn84AgCddZs8US0u0Aw7GHFVOUwRAMPP24w 1ZY3n++tIkcx33TP/MF8qENLVJeQUF/9EGmz6GYE38WW3hjdjOCXuLcBcCcmXP+nNr QmVMmRpueZJMqxCHqPZNTn9rBk1m9COYu9Sl6kuE= From: "heckflosse67 at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96133] New: x86-64 gcc 10.1 using -O3 leads to wrong calculation Date: Thu, 09 Jul 2020 11:38:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: heckflosse67 at gmx dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jul 2020 11:38:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96133 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 constexpr double xyz_sRGB[3][3] =3D { {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] =3D {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}, {7.0, 8.0, = 9.0}}; double xyz_cam[3][3] =3D {{0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, = 0.0}}; for (int i =3D 0; i < 3; i++) for (int j =3D 0; j < 3; j++) for (int k =3D 0; k < 3; k++) { xyz_cam[i][j] +=3D xyz_sRGB[i][k] * rgb_cam[k][j]; } for (int i =3D 0; i < 3; i++) for (int j =3D 0; j < 3; j++) { std::cout << xyz_cam[i][j] << std::endl; }=20 return 0; } ```=