Messages in this thread | | | Subject | Re: spinlock | From | David Wragg <> | Date | 01 Dec 1999 01:01:11 +0000 |
| |
Jamie Lokier <lkd@tantalophile.demon.co.uk> writes: > David Wragg wrote: > > Pavel Machek <pavel@suse.cz> writes: > > > We should not do such tricks. gcc 2.95 may not be clever enough, but > > > gcc 3.05? egcs people are doing subtle tricks, and we should be very > > > carefull. > > > > I thought that the trick was only there to work around a bug in older > > versions of gcc. The proper use of volatile should be enough to get > > the compiler to do the right thing, but at one point gcc didn't. > > AFAIK volatile is not enough to get _asm_ to do the right thing. > volatile guarantees visibility, but in this case it's atomicity that has > to be guaranteed.
Indeed. I was just discussing compiler issues, not asm atomicity issues.
> If volatile causes asm "m" constraints to always use the original memory > location, that would be quite useful but it is not documented to do so.
As far as I know, it doesn't and isn't.
However, the volatile qualifier is defined in the ISO C standard. If gcc breaks the restrictions on what it is allowed to do with volatile objects implied by that definition, then it has a bug. If the same restrictions don't also apply for the C expressions in inline asm constraints, then that would also be a bug, since it would be worthless as a feature. But I haven't noticed any problems in this area with recent versions of gcc/egcs.
David Wragg
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |