full memory barrier?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux