Re: [PATCH 1/24] make atomic_read() behave consistently on alpha
From: Segher Boessenkool <hidden>
Date: 2007-08-11 00:51:42
Also in:
linux-arch, lkml
From: Segher Boessenkool <hidden>
Date: 2007-08-11 00:51:42
Also in:
linux-arch, lkml
quoted
quoted
quoted
That means GCC cannot compile Linux; it already optimises some accesses to scalars to smaller accesses when it knows it is allowed to. Not often though, since it hardly ever helps in the cost model it employs.Please give an example code snippet + gcc version + arch to back this up.unsigned char f(unsigned long *p) { return *p & 1; }This doesn't really matter since we only care about the LSB.
It is exactly what I claimed, and what you asked proof of.
Do you have an example where gcc reads it non-atmoically and we care about all parts?
Like I explained in the original mail; no, I suspect such a testcase will be really hard to construct, esp. as a small testcase. I have no reason to believe it is impossible to do so though -- maybe someone else can write trickier code than I can, in which case, please do so. Segher