public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/22200] numeric_limits<signed>::is_modulo is inconsistent with gcc
Date: Wed, 07 Feb 2024 10:09:17 +0000	[thread overview]
Message-ID: <bug-22200-4-l9Ox0Onn9b@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-22200-4@http.gcc.gnu.org/bugzilla/>

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.0
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #45 from Jonathan Wakely <redi at gcc dot gnu.org> ---
https://cplusplus.github.io/LWG/issue2422 changed the spec for is_modulo to
remove the "on most machines" text and add:

  -??- [Example: is_modulo is false for signed integer types
([basic.fundamental])
  unless an implementation, as an extension to this International Standard,
defines signed
  integer overflow to wrap. — end example]

This seems very clear that numeric_limits<int>::is_modulo should be false
*unless* -fwrapv is used. I'm going to close this now. If GCC gets a macro that
allows us to detect the presence of -fwrapv we can revisit it.

N.B. Since C++17 is_modulo is an inline variable and so no extern definition in
libstdc++.so is needed. If we made it depend on -fwrapv then you would still
get ODR violations between different translation units compiled with different
-fwrapv states, but at least you wouldn't get a value from libstdc++.so that
ignores the current TU.

  parent reply	other threads:[~2024-02-07 10:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-22200-4@http.gcc.gnu.org/bugzilla/>
2012-02-29 12:41 ` marc.glisse at normalesup dot org
2012-02-29 13:41 ` gdr at gcc dot gnu.org
2012-04-29  9:26 ` paolo at gcc dot gnu.org
2012-05-05  1:13 ` glisse at gcc dot gnu.org
2023-06-01  9:37 ` redi at gcc dot gnu.org
2024-02-07 10:09 ` redi at gcc dot gnu.org [this message]
2024-02-07 11:46 ` pinskia at gcc dot gnu.org
     [not found] <bug-22200-2544@http.gcc.gnu.org/bugzilla/>
2010-02-18 22:03 ` paolo dot carlini at oracle dot com
2010-02-19 10:22 ` rguenth at gcc dot gnu dot org
2010-02-19 10:30 ` paolo dot carlini at oracle dot com
2010-02-19 11:13 ` joseph at codesourcery dot com
2010-02-19 11:19 ` paolo dot carlini at oracle dot com
2010-02-19 11:26 ` paolo dot carlini at oracle dot com
2010-02-21  7:53 ` veksler at il dot ibm dot com
2010-02-21  9:51 ` paolo dot carlini at oracle dot com
2010-02-21 12:44 ` veksler at il dot ibm dot com
2010-02-21 12:54 ` paolo dot carlini at oracle dot com
2010-02-21 13:04 ` rguenth at gcc dot gnu dot org
2010-02-21 13:33 ` veksler at il dot ibm dot com
2010-02-21 13:37 ` rguenther at suse dot de
2010-02-21 18:04 ` gdr at integrable-solutions dot net
2010-02-21 18:20 ` veksler at il dot ibm dot com
2010-02-21 18:50 ` gdr at integrable-solutions dot net

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-22200-4-l9Ox0Onn9b@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: link
Be 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).