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? (was: avoid integer


From: Richard B. Kreckel
Subject: Re: GCC optimizes integer overflow: bug or feature? (was: avoid integer overflow in mktime.m4)
Date: Wed, 20 Dec 2006 00:10:59 +0100 (CET)

On Mon, 18 Dec 2006, Andrew Pinski wrote:
> On Tue, address@hidden:54 +0100, Ralf Wildenhues wrote:
> > > Wheeeoo!  That optimization is going to break a _lot_ of GNU
> > > software.  (Silently.  Oh my.)
>
> Just like say strict aliasing? :)

I find an analogy with -ffast-math much less far-fetched than one with
-fstrict-aliasing. Quoting from the GCC documentation:

     This option [-ffast-math] should never be turned on by any `-O'
     option since it can result in incorrect output for programs which
     depend on an exact implementation of IEEE or ISO rules/specifications
     for math functions.

C89 did not refer to IEEE 754 / IEC 60559. Yet, as far as I am aware,
-ffast-math or the implied optimizations have never been turned on by GCC
unless explicitly requested. That was a wise decision.

By the same token it would be wise to refrain from turning on any
optimization that breaks programs which depend on wrapping signed
integers. Silently breaking LIA-1 semantics is imprudent.

  -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>





reply via email to

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