This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to cast away 'volatile'?


Andrew Haley <aph@redhat.com> writes:

> I didn't mean to suggest that volatile would necessarily be
> sufficient, but that it would be necessary.  Surely the compiler needs
> to know that the buffer is volatile, or what's to stop it re-ordering
> accesses around the asm statements that are the memory barriers?  I
> know that in gcc we add a memory clobber to such asms, but that isn't
> generally true.  OK, if we have POSIX threads we also have POSIX
> mutexes...

Right: you have to use a mutex for correctness, and the mutex has to
be magic.  And once you use a magic mutex, using volatile doesn't make
any difference.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]