full memory barrier?
Hei Chan
structurechart@yahoo.com
Mon Apr 11 21:00:00 GMT 2011
Hi,
I am a little bit confused what asm volatile ("" : : : "memory") does.
I searched online; many people said that it creates the "full memory barrier".
I have a test code:
int main() {
bool bar;
asm volatile ("" : : : "memory");
bar = true;
return 1;
}
Running g++ -c -g -Wa,-a,-ad foo.cpp gives me:
2:foo.cpp **** bool bar;
3:foo.cpp **** asm volatile ("" : : : "memory");
22 .loc 1 3 0
4:foo.cpp **** bar = true;
23 .loc 1 4 0
It doesn't involve any fence instruction.
Maybe I completely misunderstand the idea of "full memory barrier".
Any hint?
Thanks in advance.
Cheers,
Hei
More information about the Gcc-help
mailing list