Date: Wed, 15 May 2002 21:34:06 +0200 From: Robert Drehmel <robert@ferrari-electronic.de> To: Akinori MUSHA <knu@iDaemons.org> Cc: audit@FreeBSD.org, current@FreeBSD.org Subject: Re: moused(8): char signed-ness problem with gcc 3.1 Message-ID: <20020515213406.A30720@alpha.develop.ferrari.net> In-Reply-To: <86sn4t8fzp.wl@archon.local.idaemons.org> References: <86sn4t8fzp.wl@archon.local.idaemons.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020515213406.A30720>