public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gdr at integrable-solutions dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/22200] numeric_limits<signed>::is_modulo is inconsistend with gcc
Date: Mon, 27 Jun 2005 18:23:00 -0000	[thread overview]
Message-ID: <20050627182324.14102.qmail@sourceware.org> (raw)
In-Reply-To: <20050627151911.22200.veksler@il.ibm.com>


------- Additional Comments From gdr at integrable-solutions dot net  2005-06-27 18:23 -------
Subject: Re:  numeric_limits<signed>::is_modulo is inconsistend with gcc

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-27 17:29 -------
| (In reply to comment #7)
| > Andrew --
| > 
| > You do not seem to understand this PR.  Please DO NOT close it.
| > Your eagerness to close PRs is doing harms -- that was already debated
| > last couple o weeks and I do not want to repeat that again.
| 
| yes it will be debated until the end of time.  INT_MIN/-1 is undefined as declared by the C/C++ 
| standards so this is invalid.  we get modulo results most of the time, but again since this is undefined, 

The issue is whether that modulo result is taken to be the definition that
GCC gives to the operation.  At this point, saying "the standard 
says it is undefined behaviour" is pointless and unhelpful.

| we may as well say it is modulo because it is.

Yes, that is part of the issue.

|  I think the standard say that if two postive values are  
| added to and you __may__ get a value that is less than both of them,

yes, but at this point we're more interesting in what GCC decides that
behaviour should be.  It is irrelevant to say "the standard says it is
undefined behaviour".

| then is_modulo should be set to  true.  (I don't have the copy right in front of me right now but IIRC that is what it says)
| 
| 
| In fact from the comment in std_limits.h says "if possible" meaning "may":
|     /** True if the type is @e modulo, that is, if it is possible to add two
|         positive numbers and have a result that wraps around to a third number
|         that is less.  Typically false for floating types, true for unsigned
|         integers, and true for signed integers.  */

Thanks, I'm the author of <limits>.  For all useful purposes, please
Andrew go back and read the link I gave to RTH's message.

-- Gaby


-- 


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


  parent reply	other threads:[~2005-06-27 18:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-27 15:19 [Bug libstdc++/22200] New: " veksler at il dot ibm dot com
2005-06-27 15:21 ` [Bug libstdc++/22200] " pinskia at gcc dot gnu dot org
2005-06-27 15:33 ` veksler at il dot ibm dot com
2005-06-27 15:40 ` pinskia at gcc dot gnu dot org
2005-06-27 16:06 ` gdr at integrable-solutions dot net
2005-06-27 16:07 ` pinskia at gcc dot gnu dot org
2005-06-27 16:24   ` Gabriel Dos Reis
2005-06-27 16:09 ` gdr at integrable-solutions dot net
2005-06-27 16:21 ` gdr at gcc dot gnu dot org
2005-06-27 16:25 ` gdr at integrable-solutions dot net
2005-06-27 16:53   ` Andrew Pinski
2005-06-27 16:32 ` themis_hv at yahoo dot co dot uk
2005-06-27 16:35 ` veksler at il dot ibm dot com
2005-06-27 16:53 ` pinskia at physics dot uc dot edu
2005-06-27 17:29 ` pinskia at gcc dot gnu dot org
2005-06-27 17:34 ` pinskia at gcc dot gnu dot org
2005-06-27 18:00 ` schlie at comcast dot net
2005-06-27 18:19 ` gdr at integrable-solutions dot net
2005-06-27 18:23 ` gdr at integrable-solutions dot net [this message]
2005-06-27 18:26 ` gdr at gcc dot gnu dot org
2005-06-27 18:27 ` gdr at integrable-solutions dot net
2005-06-27 18:34 ` pinskia at gcc dot gnu dot org
2005-06-27 18:46 ` gdr at integrable-solutions dot net
2005-06-27 20:28 ` veksler at il dot ibm dot com
2005-06-27 21:02 ` pinskia at gcc dot gnu dot org
2005-06-27 22:00 ` veksler at il dot ibm dot com

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