Date: Tue, 16 Nov 1999 13:23:49 +1100 From: "Andrew Reilly" <areilly@nsw.bigpond.net.au> To: Pierre Beyssac <beyssac@enst.fr> Cc: freebsd-current@FreeBSD.ORG Subject: Re: egcs -O breaks ping.c:in_cksum() Message-ID: <19991116132349.B40907@gurney.reilly.home> In-Reply-To: <19991115174831.B30139@enst.fr> References: <19991115174831.B30139@enst.fr>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 15, 1999 at 05:48:31PM +0100, Pierre Beyssac wrote: > The problem is apparently due to the following code fragment: > > register u_short answer = 0; > [...] > /* mop up an odd byte, if necessary */ > if (nleft == 1) { > *(u_char *)(&answer) = *(u_char *)w ; > sum += answer; > } > > Removing the "register" declaration for 'answer' doesn't help. That code should not even compile, since standard C says that you _can't_ derefrence a register variable. That's about the only genuine semantic content of the register keyword now. The fix with a union (in another message) is the right way to do it, and doesn't even require that "answer" be in addressable storage. (I.e., it can now be optimised into a register). -- Andrew 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?19991116132349.B40907>