...
Panel | ||
---|---|---|
| ||
This otherwise useful howto (GCC-Inline-Assembly-HOWTO) claims the following:
However, this contradicts the gcc manual, which clearly states that the volatile keyword on asm statements will not stop the compiler from moving the asm instructions, including across jump instructions (see Extended Asm in the GCC manual). |
Clobbers memory
From Extended Asm in the GCC manual:
If your assembler instructions access memory in an unpredictable fashion, add `memory' to the list of clobbered registers. This will cause GCC to not keep memory values cached in registers across the assembler instruction and not optimize stores or loads to that memory. You will also want to add the volatile keyword if the memory affected is not listed in the inputs or outputs of the asm, as the `memory' clobber does not count as a side-effect of the asm.
Volatile keyword elsewhere
...