autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."


From: Robert Dewar
Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
Date: Sun, 31 Dec 2006 10:07:44 -0500
User-agent: Thunderbird 1.5.0.9 (Windows/20061207)

Vincent Lefevre wrote:

If done in unsigned, this won't lead to any optimization, as unsigned
arithmetic doesn't have overflows. So, if you write "a - 10" where a
is unsigned, the compiler can't assume anything, whereas is a is
signed, the compiler can assume that a >= INT_MIN + 10, reducing
the range for a, and possibly allowing some optimizations.

Vincent, you missed the point, if we do this in unsigned, it works
fine, and we don't WANT any optimization to intefere. That's what
Richard was saying, if you want to do this kind of hand optimization
of range checking, you do it in unsigned, and everything is fine.

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"

is not very convincing to users who find other compilers that
handle their code just fine.

I remember that in Realia COBOL days, it was not just a matter
of dealing with undefined situations, there were actually a
couple of cases where the IBM compiler had semantics that were
definitely non-conforming to the COBOL standard. Users depended
on these bugs, so we carefully copied them in Realia COBOL.

Sure, we could have explained to users that their code was
junk, and the IBM compiler was wrong, but that would not have
convinced them to move to using Realia COBOL!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]