Re: Is gcc thread-unsafe?

Alan Cox
2007-10-26T18:07:27Z

> non-volatile variables. But for asm statements this can be solved by
> adding memory to the list of clobbered registers -- this will prevent
> any reordering of manipulations of non-volatile variables and asm
> statements.

IFF the processor doesn't reorder them in hardware, which on some
processors is visibly out of order when viewed from an I/O device or
another CPU.

You can stop the compiler but not the CPU - and some processors will
certainly speculatively load across conditionals, reorder writes etc