mktime.c fixes (part 4 of 6): verify assumptions at compile-time

Joseph S. Myers jsm@polyomino.org.uk
Wed Dec 31 22:57:00 GMT 2003


On Wed, 31 Dec 2003, Paul Eggert wrote:

> If you are modifying GCC to do GCC-2.2.2-style optimization again,
> please disable the optimization by default.  It's quite OK to have it

Having these optimizations again is hardly new.  For example, GCC 3.0.4 
optimizes out the multiplication and division in

int f (int a) { return (2 * a) / 2; }

(so do 2.7.2.3 through 2.95.3, but in those cases it's simply a broken
optimization as they do it for unsigned as well).  I suspect there have
been other instances for longer (and -fwrapv may not yet work perfectly,
as such assumptions about undefined behavior have had a long time to get
into various parts of the compiler).

-- 
Joseph S. Myers
jsm@polyomino.org.uk



More information about the Gcc mailing list