Re: moused(8): char signed-ness problem with gcc 3.1
Robert Drehmel <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.audit |
|---|---|
| Message-ID | <[email protected]> |
On Thu, May 16, 2002 at 02:42:34AM +0900, Akinori MUSHA wrote:
> I observed gcc 2.95.4 and gcc 3.1 interpret (or maybe optimize) the
> following code differently (CFLAGS=-O):
>
> int main(void)
> {
> unsigned char i = 127;
> printf("%d\n", ((char)(i << 1)) / 2);
> return 0;
> }
I think GCC 3.1 does a logical right shift by one to
optimize the division by two instead of an arithmetic
right shift.
ciao,
-robert
To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-audit" in the body of the message