public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pdimov at gmail dot com" <gcc-bugzilla@gcc.gnu.org> 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 [thread overview] Message-ID: <bug-110476-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110476 Bug ID: 110476 Summary: constexpr floating point regression with -std=c++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 == 3.14f ); } fails under GCC 13/14 with <source>: In function 'int main()': <source>:11:24: error: static assertion failed: x.f == 3.14f 11 | STATIC_ASSERT( x.f == 3.14f ); | ~~~~^~~~~~~~ <source>:1:42: note: in definition of macro 'STATIC_ASSERT' 1 | #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) | ^~~~~~~~~~~ <source>:11:24: note: the comparison reduces to '(3.14000010490417480469e+0l == 3.1400000000000000001e+0l)' 11 | STATIC_ASSERT( x.f == 3.14f ); | ~~~~^~~~~~~~ when compiled with -m32 -std=c++XX under x86 (https://godbolt.org/z/Ghs7j5Teq). The reason is that -std=c++XX implies -fexcess-precision=standard (https://godbolt.org/z/zx4rn4j5W). Previous versions worked fine.
next reply other threads:[~2023-06-29 6:52 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-29 6:52 pdimov at gmail dot com [this message] 2023-06-29 8:03 ` [Bug c++/110476] " pdimov at gmail dot com 2023-06-29 11:02 ` pdimov at gmail dot com 2023-06-29 11:12 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-110476-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).