<<On Mon, 15 Nov 1999 18:01:45 +0100, Pierre Beyssac <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]  | 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to