This is the mail archive of the gcc@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: Memory Barrier [Q]


Zach, Yoav wrote:
Can someone help me with this question I have about gcc - How gcc treats
the instruction 'asm("":::"memory")' ?

For optimization purposes, it will act like a memory barrier. The memory clobber means that it may change memory in unexplained ways. Also, an asm with no output is automatically volatile, and volatile means that it may change processor state in unexplained ways.


Thus the compiler will avoid optimizations that move instructions or values from memory across the asm.

See also the documentation in the gcc manual.
http://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Extended-Asm.html#Extended%20Asm

Jim


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