Re: const versus __attribute__((const))

From: Linus Torvalds
Date: Tue Dec 09 2003 - 02:22:01 EST




On Tue, 9 Dec 2003, Jamie Lokier wrote:
>
> (A long time ago there was a question about whether GCC could ever
> copy the value associated with an "m" operand to a stack slot, and
> pass the address of the stack slot. After all, GCC _will_ copy the
> value if the operand is an "r", and presumably gives mixed results
> with "rm". We seem to have concluded that it never will).

We never never concluded that they never would, but we did (I think)
convince the gcc people that a memory operand to an asm should always be
considered a lvalue. That will effectively mean that we know a memory op
will never be moved around - because then it wouldn't be the same lvalue
any more (a lvalue is literally defined by its address).

So yes, I think we can depend on it now, although we historically
couldn't.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/