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 ..."


Gerald Pfeifer wrote:
On Sun, 31 Dec 2006, Robert Dewar wrote:
If you do it in signed expecting wrapping, then the optimization
destroys your code. Yes, it is technically your fault, but this
business of telling users

"sorry, your code is non-standard, gcc won't handle it as you
expect, go fix your code"

My understanding of previous messages in this thread was that other compilers (like ICC) do enable the optimization we are talking about here by default.

Well that's not such a clear criterion. "the optimization" here is misleading, what we really have is a whole class of optimizations enabled by taking advantage of signed overflow being undefined.

How energetic compilers are in taking advantage of this will vary
a lot, and is neither easy to determine nor document. What you have
is another assertion that the compiler can propagate to determine
optimization conditions. Whether this assertion is propagated
forwards and/or backwards, and how far-reaching the effect of the
assertion is will depend on the structure of the compiler and how
good it is at theorem proving internally.

So all we can say is that other compilers (including ICC) take
advantage of this assertion, but that does not mean that the
performance or behavior of the generated code will be equivalent
or even similar with respect to this particular condition.



Did I misunderstand?


Gerald


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