------- Comment #36 from rguenther at suse dot de  2010-02-21 13:37 -------
Subject: Re:  numeric_limits<signed>::is_modulo is
 inconsistent with gcc

On Sun, 21 Feb 2010, veksler at il dot ibm dot com wrote:

> > Or suspend it.  I think this warrants a defect report anyway since I think
> > is_modulo was intended to describe CPU behavior as otherwise defining
> > signed integer overflow as undefined in one piece of the standard and
> > then requiring a sane answer for is_modulo in another part sounds
> > like a conflict of interest.
> > 
> Maybe it is better to make things clear, but I am not so sure of the 
> outcome. I think that is_modulo is meaningful only if it is true, otherwise,
> when false user's code can't rely on any specific behavior. 
> Maybe is_modulo=false is the right answer even for -fwrapv after all.

Or maybe is_modulo=true has only practical meaning for code that
doesn't invoke undefined behavior anyway (like adding two
signed integers when the operation will overflow).  That also
avoids the /-1 and %-1 issues.

It really depends on how is_modulo was supposed to be used.

Richard.


-- 


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

Reply via email to