public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "veksler at il dot ibm dot com" <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: Sun, 21 Feb 2010 12:44:00 -0000	[thread overview]
Message-ID: <20100221124414.17243.qmail@sourceware.org> (raw)
In-Reply-To: <bug-22200-2544@http.gcc.gnu.org/bugzilla/>



------- Comment #32 from veksler at il dot ibm dot com  2010-02-21 12:44 -------
(In reply to comment #31)
> (In reply to comment #30)
> > Wouldn't it be a violation of the one definition rule (ODR), 
> > when one translation unit is compiled with -fwrapv and another without?
> > In that case this would be a regression.
> 
> I don't know if this comes as a surprise to you, but in the library we have
> *tons* of potential violations of this type, due to command line switches, not
> just the big cases like debug-mode, but also rtti, exceptions, etc. That said,
> if people prefer a false value, always, just tell me and let's close this PR
> because I don't think the compiler is going to change any time soon to warrant
> a true value irrespective of any command line option ...

If this hazard is so prevalent shouldn't it deserve a separate PR?
If a method or function depend on a flag or macro then it can be handled
by overloading and specialization without ODR violation.

When this hazard is, like in this case, appears in a constant then things
are more difficult. An unexpected behavior may be observed when is_modulo
is passed by reference, and I don't see what can be done in this case,
not in 100% of the scenarios. Even if GCC annotates the two different 
variants of is_modulo differently, such that there will be two different
physical allocations of is_modulo, it will still be possible to get to
some misbehavior in weird cases. Oh well...


-- 


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


  parent reply	other threads:[~2010-02-21 12:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
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
     [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
2024-02-07 11:46 ` pinskia 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=20100221124414.17243.qmail@sourceware.org \
    --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).