Date: Mon, 15 Nov 1999 13:35:15 -0500 (EST) From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> To: Pierre Beyssac <beyssac@enst.fr> Cc: Sheldon Hearn <sheldonh@uunet.co.za>, freebsd-current@FreeBSD.ORG Subject: Re: egcs -O breaks ping.c:in_cksum() Message-ID: <199911151835.NAA07676@khavrinen.lcs.mit.edu> In-Reply-To: <19991115180145.A31542@enst.fr> References: <19991115174831.B30139@enst.fr> <92805.942684743@axl.noc.iafrica.com> <19991115180145.A31542@enst.fr>
next in thread | previous in thread | raw e-mail | index | archive | help
<<On Mon, 15 Nov 1999 18:01:45 +0100, Pierre Beyssac <beyssac@enst.fr> said: > Maybe I can at least commit the addition of "volatile" to the source > code. That will work around that particular bug until egcs is > fixed... It's not a compiler bug, it's a source code bug. The C Language specifies that pointers to distinct types can be assumed, under certain conditions, never to alias one another. (This might actually be a C99 feature as opposed to C89.) Recent values of GCC make use of this obscure language feature to improve optimization. Essentially, the optimizer can assume that stores through a pointer of type `foo *' will never modify any local variable which is not of type `foo' (and thus those values can remain cached in registers). If, rather than casting pointers, the code used a union (containing one u_int16_t and one array[2] of u_int8_t), the compiler would have enough information to know about the aliases. -GAWollman -- Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same wollman@lcs.mit.edu | O Siem / The fires of freedom Opinions not those of| Dance in the burning flame MIT, LCS, CRS, or NSA| - Susan Aglukark and Chad Irschick 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?199911151835.NAA07676>