This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Does the keyword volatile work?
On 12-May-2003, Stephen P. Smith <ischis2@cox.net> wrote:
> Ok, I did what I thought you told me to do, and it didn't work.
> assignThisNow isn't getting set right away.
>
> 258:../../code/ipc/ipck.cpp **** DWORD CDECL someFunction( DWORD, DWORD
> p1, DWORD, DWORD, DWORD, DWORD)
> 259:../../code/ipc/ipck.cpp **** {
> 433 .LM1:
> 434 0000 55 pushl %ebp
> 435 0001 89E5 movl %esp, %ebp
> 436 0003 56 pushl %esi
> 437 0004 53 pushl %ebx
> 260:../../code/ipc/ipck.cpp **** volatile DWORD assignThisNow =
> *(volatile DWORD *)&p1;
> 261:../../code/ipc/ipck.cpp **** NumericNameTYP threadName =
> (NumericNameTYP) assignThisNow;
> 262:../../code/ipc/ipck.cpp **** DWORD periodIndex = 0;
> 439 .LM2:
> 440 .LBB2:
> 441 0005 31F6 xorl %esi, %esi
Declaring things as volatile doesn't guarantee that the compiler won't
put some other, non-volatile computation at the start of the function.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.