Re: gcc-2.8.0 miscompiles kernel (Was: gcc-2.8 out...)

Olivier Galibert (galibert@pobox.com)
Mon, 19 Jan 1998 22:20:03 +0100


On Mon, Jan 19, 1998 at 08:43:20PM +0000, Alan Cox wrote:
> If *((volatile u32 *)&eflags=val doesnt generate code then gcc is buggy.
> Volatile tells the compiler the value may change behinds its back, and the
> compiler is not allowed to assume otherwise.
>
> That one is a bug, perhaps the egcs folks would care to squidge it. The
> non volatile case is a kernel error

Hmmmmm, are you _sure_ that's a bug ? The cast says that the pointed
value is volatile, not the pointer itself. So the compiler can, I
think, still legally assume that the memory zone assigned through the
pointer will be destroyed after the return.

*((u32 * volatile)&eflags)=val; should make it behave though. I'm not
really sure. That's quite a tricky part of the standard.

OG.