This is the mail archive of the gcc@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: changing "configure" to default to "gcc -g -O2 -fwrapv ..."


On 12/31/06, Robert Dewar <dewar@adacore.com> wrote:
Paul Eggert wrote:

> The question is not whether GCC should support wrapv
> semantics; it already does, if you specify -fwrapv.
> The question is merely whether wrapv should be the default
> with optimization levels -O0 through -O2.

That over simplifies, because it presents things as though
there are only two possibilities

1. Allow "undefined" optimizations without restriction

2. Forbid all such optimizations by specifying fwrapv

Quite a few of us (including certainly me, and I think
Richard) argue for a mid ground where

We don't insist on full fwrapv semantics (because we
think it will hurt code equality, particularly in the
loop invariant case).

We are judcious in applying the optimization in other
cases in a pragmatic attempt to keep "traditional"
C code working in practice.

I think this is a fragile and not very practical approach. How do you define these "traditional" cases? I guess you would keep the other two as well, so have the mid ground default, -fno-wrapv do what we have now and -fwrapv disable all the optimizations.

I'd rather enable -fwrapv at -O1 and keep -O2 as is.  This is
what we also do for strict-aliasing, it's enabled at -O2 and beyond
only (for C, that is).  Of course with -O1 the VRP pass is not run, so
it might be that the reported problems do not show up with -O1 - and
as they are reportedly not for performance critical code they should
maybe just use -O1 as autoconf default.

Richard.


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