bug-gnulib
[Top][All Lists]
Advanced

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

Re: GCC optimizes integer overflow: bug or feature?


From: Brooks Moses
Subject: Re: GCC optimizes integer overflow: bug or feature?
Date: Mon, 18 Dec 2006 23:43:04 -0800
User-agent: Thunderbird 1.5.0.8 (Windows/20061025)

Andrew Pinski wrote:
On Tue, 2006-12-19 at 06:54 +0100, Ralf Wildenhues wrote:
[quoting Paul Eggert]
Surely the GCC guys care about LIA-1.  After all, gcc has an
-ftrapv option to enable reliable signal generation on signed
overflow.  But I'd rather not go the -ftrapv route, since that
will cause other problems.

Lets see, the C standard is very very specific about signed overflow as
being undefined and LIA-1 says it is defined, well I guess I follow the
C standard rather than LIA-1.

I have no position on the greater argument, but that seems like a very misleading reference to how standards work. The choice is not one or the other; "undefined" does not mean that you are _required_ to make it break code if people use it. And it is certainly a respected practice to define additional standards that go _on top of_ other standards, and add constraints that were not present in the original while retaining all of the original standard, and define things that would otherwise be undefined.

So the question here is _not_ one or the other. It is assumed as given that GCC follows the C standard; the question is merely whether GCC should also follow the LIA-1 standard as well.

Now, if your argument is that following the LIA-1 standard will prevent optimizations that could otherwise be made if one followed only the C standard, that's a reasonable argument, but it should not be couched as if it implies that preventing the optimizations would not be following the C standard.

- Brooks





reply via email to

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