|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>|
|References:||<20040512020700.6f6aa61f.akpm@xxxxxxxx> <20040512181903.GG13421@xxxxxxxxx> <40A26FFA.4030701@xxxxxxxxx> <20040512193349.GA14936@xxxxxxx> <Pine.LNX.4.58.0405121247011.11950@xxxxxxxxxxxxxxxxxxxxxxx> <20040512200305.GA16078@xxxxxxx> <Pine.LNX.4.58.0405121400360.11950@xxxxxxxxxxxxxxxxxxxxxxx> <20040512213913.GA16658@xxxxxxxxxxxx> <jevfj1nwe1.fsf@xxxxxxxxxxxxx> <20040516034847.GA5774@xxxxxxxxxxxxxxxxxxxxx>|
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.
|<Prev in Thread]||Current Thread||[Next in Thread>|