public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111808] New: [C23] constexpr
@ 2023-10-14 14:47 muecker at gwdg dot de
  2023-10-14 16:44 ` [Bug c/111808] [C23] constexpr with excess precision jakub at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: muecker at gwdg dot de @ 2023-10-14 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111808
           Summary: [C23] constexpr
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

GCC implements constraint 6.7.1p5 for constexpr initialized with a float
pointer value as an error.  For example, the following fails to compile on
i386:

int func(void) 
{
  constexpr double f2 = 1. / 3.;
  return 3. * f2 == 3. * (1. / 3.);
}

with

<source>: In function 'func':
<source>:7:25: error: 'constexpr' initializer not representable in type of
object
    7 |   constexpr double f2 = 1. / 3.;

while it compiles on x64-86.  This seems problematic because this it will cause
a lot surprising failures when compiling code written for x64-86 on i386.  We
should either have a warning that such code is non-portable (but this seems
difficult) or downgrade this to a warning and accept the code as an extension
on architectures which compute with excess precision.

https://godbolt.org/z/7vsWhvKjd

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

end of thread, other threads:[~2023-10-18 15:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-14 14:47 [Bug c/111808] New: [C23] constexpr muecker at gwdg dot de
2023-10-14 16:44 ` [Bug c/111808] [C23] constexpr with excess precision jakub at gcc dot gnu.org
2023-10-14 17:08 ` muecker at gwdg dot de
2023-10-14 17:21 ` jakub at gcc dot gnu.org
2023-10-16 14:53 ` Laurent.Rineau__gcc at normalesup dot org
2023-10-16 21:13 ` joseph at codesourcery dot com
2023-10-17 16:50 ` muecker at gwdg dot de
2023-10-17 19:42 ` joseph at codesourcery dot com
2023-10-18  6:54 ` muecker at gwdg dot de
2023-10-18 15:42 ` joseph at codesourcery dot com

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