[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A1B3241.3080509@zytor.com>
Date: Mon, 25 May 2009 17:05:21 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: lkml@...ethan.org
CC: Harald Welte <HaraldWelte@...tech.com>,
Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, Alan Cox <alan@...rguk.ukuu.org.uk>
Subject: Re: [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic
Michael S. Zick wrote:
>
> Load Effective Address does two's complement arithmetic?
> I'll take your word for it.
>
LEA, and all other address calculations use 2's-complement arithmetic:
leal -1(%ebx),%eax
leal 0xffffffff(%ebx),%eax
... is the same instruction.
However, gcc has been known to optimize out range checks when operating
on signed integers; it is allowed to do this by the C standard, but it
can give surprising results if the user expected wraparound.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists