netdev
[Top] [All Lists]

Re: MSEC_TO_JIFFIES is messed up...

To: Chris Wedgwood <cw@xxxxxxxx>
Subject: Re: MSEC_TO_JIFFIES is messed up...
From: Paul Wagland <paul@xxxxxxxxxxx>
Date: Sun, 16 May 2004 14:10:06 +0200
Cc: Andrew Morton <akpm@xxxxxxxx>, Davide Libenzi <davidel@xxxxxxxxxxxxxxx>, Netdev <netdev@xxxxxxxxxxx>, Jeff Garzik <jgarzik@xxxxxxxxx>, "J. Bruce Fields" <bfields@xxxxxxxxxxxx>, Andreas Schwab <schwab@xxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxx>, Greg KH <greg@xxxxxxxxx>
In-reply-to: <20040516034847.GA5774@taniwha.stupidest.org>
References: <20040512020700.6f6aa61f.akpm@osdl.org> <20040512181903.GG13421@kroah.com> <40A26FFA.4030701@pobox.com> <20040512193349.GA14936@elte.hu> <Pine.LNX.4.58.0405121247011.11950@bigblue.dev.mdolabs.com> <20040512200305.GA16078@elte.hu> <Pine.LNX.4.58.0405121400360.11950@bigblue.dev.mdolabs.com> <20040512213913.GA16658@fieldses.org> <jevfj1nwe1.fsf@sykes.suse.de> <20040516034847.GA5774@taniwha.stupidest.org>
Sender: netdev-bounce@xxxxxxxxxxx

On May 16, 2004, at 5:48, Chris Wedgwood wrote:

On Wed, May 12, 2004 at 11:55:18PM +0200, Andreas Schwab wrote:

Signed integer overflow is undefined in C, so the compiler is
allowed to assume it does not happen.

Really?

Just because something is undefined assuming it never happens is a bit
of a leap of faith IMO.

More precisely, if something has undefined semantics then the compiler is allowed to do whatever it likes. Normally the compiler will try to do "what's right", but if they have an optimisation opportunity then they will normally take it.


In other words by assuming it "doesn't happen" they get to perform an optimisation that they could not do otherwise, and they get to perform "correctly" in an undefined way when the overflow would happen.

Cheers,
Paul

Attachment: PGP.sig
Description: This is a digitally signed message part

<Prev in Thread] Current Thread [Next in Thread>