This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH RFC: -fstrict-overflow


Diego Novillo <dnovillo@redhat.com> writes:

> Ian Lance Taylor wrote on 01/24/07 12:29:
> 
> > Basically, -fwrapv extends the language standard to say "signed
> > integers wrap."  -fno-strict-overflow does not change the language
> > standard--signed overflow remains undefined--but the compiler does not
> > take advantage of that fact.
> > In particular, with -fno-strict-overflow, the compiler does not
> > change
> > code which might overflow into code which will not overflow.  With
> > -fwrapv, the compiler permits overflow when folding constants.
> >
> Sorry, I'm dense today.  My suggestion is along the lines of: Since
> -fwrapv allows integers to wrap, the compiler should not take
> advantage of the fact there was overflow.

Yes, that is how -fwrapv works.  If you use -fwrapv, then it doesn't
matter whether you use -fstrict-overflow or -fno-strict-overflow.
There is no overflow anyhow.  -f[no-]strict-overflow only changes
behaviour in the absence of -fwrapv.

> That was sort of the mindset I had when doing the -fwrapv checking in
> VRP initially.  I'm not good with language lawyering, so that's
> probably why I can't find a great difference between -fwrapv and
> -fstrict-overflow.  Don't let me stand in the way, though.  If the
> consensus is that the -fstrict-overflow flag improves things, I'll go
> with that.

There isn't a big difference.  It's just that there is a small
difference which I think is worth preserving.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]