Re: [patch] i386: make bitops safe
From: Richard Henderson
Date: Mon Feb 27 2006 - 19:52:33 EST
On Tue, Feb 28, 2006 at 12:47:22AM +0100, Andi Kleen wrote:
> I remember asking rth about this at some point and IIRC
> he expressed doubts if it would actually do what expected. Richard?
It's a bit dicey to be sure. GCC may or may not be able to look
through the size of the array and not kill things beyond it. If
one could be *sure* of some actual maximum index, this would be
fine, but I don't think you can.
One could reasonably argue that if you used a structure with a
flexible array member, that GCC could not look through that. But
again I'm not 100% positive this is handled properly.
I think the best argument for simply leaving things with a memory
clobber is that these are atomic operations, and are on occasion
used as locks, or parts of locks.
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/