Do C++ signed types have modulo semantics?

Nicholas Nethercote njn@cs.utexas.edu
Wed Jun 29 19:13:00 GMT 2005


On Wed, 29 Jun 2005, Daniel Berlin wrote:

> So i would advise anyone arguing against turning on -fwrapv simply
> because it doesn't seem to hurt us at O2.
>
> And i'll again point out that the exact opposite is the default in every
> other compiler i'm aware of.

Sorry, I couldn't parse those sentences...  are you saying the -fwrapv 
behaviour (ie. wrap-on-signed-integer-overflow) is the default or not the 
default in these other compilers?

> XLC at O2 has qstrict_induction on by default (the equivalent), and
> warns the user when it sees a loop where it's making the assumption[1]

Which assumption?

> The XLC people told me since they turned this on in 1998, they have had
> one real piece of code where it actually mattered, and that was a char
> induction variable.
>
> ICC does the same, though i don't think it bothers to warn.
>
> Open64 does the same, but no warning.
>
> Not sure about Sun CC, but i'd be very surprised if they did it.
>
> Personally, i only care about wrapping for induction variables.  If you
> guys want to leave regular variables to do whatever, fine.

Are you saying you don't want induction variables to have to wrap, but you 
don't care about non-induction variables?

Sorry if I'm being dim... I think it's excellent you're discussing what 
other compilers do, I just can't understand what you've said as expressed 
:)

Nick



More information about the Gcc mailing list