From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 753873858C66; Thu, 29 Jun 2023 06:52:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 753873858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688021551; bh=x6q3TY3zy1WiwReczsLSooRsA/4tr/2njrTGr+5kXoo=; h=From:To:Subject:Date:From; b=HSYbicv7t1ROcMQMSORHbU1W2XdpRL1juuu9eF+E6JSNT0P9l8JlLu9GZW3O9WWiP 4y+Ca9fyPbz7ORVvoRnkTpaBpLijH+8Ah4LOimChAts7I4smoix7RFvj//OBp9MoPD JSKg5pv0aWtABBXNKzxBdlVQOAYc5M5WpovdMXRM= From: "pdimov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110476] New: constexpr floating point regression with -std=c++XX Date: Thu, 29 Jun 2023 06:52:30 +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: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pdimov at gmail dot com 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110476 Bug ID: 110476 Summary: constexpr floating point regression with -std=3Dc++XX Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pdimov at gmail dot com Target Milestone: --- The following program #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) struct X { float f; }; int main() { constexpr X x{ 3.14f }; STATIC_ASSERT( x.f =3D=3D 3.14f ); } fails under GCC 13/14 with : In function 'int main()': :11:24: error: static assertion failed: x.f =3D=3D 3.14f 11 | STATIC_ASSERT( x.f =3D=3D 3.14f ); | ~~~~^~~~~~~~ :1:42: note: in definition of macro 'STATIC_ASSERT' 1 | #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) | ^~~~~~~~~~~ :11:24: note: the comparison reduces to '(3.14000010490417480469e+0= l =3D=3D 3.1400000000000000001e+0l)' 11 | STATIC_ASSERT( x.f =3D=3D 3.14f ); | ~~~~^~~~~~~~ when compiled with -m32 -std=3Dc++XX under x86 (https://godbolt.org/z/Ghs7j= 5Teq). The reason is that -std=3Dc++XX implies -fexcess-precision=3Dstandard (https://godbolt.org/z/zx4rn4j5W). Previous versions worked fine.=