How To Add a Sequence Point?

Ian Lance Taylor iant@google.com
Mon Feb 4 04:46:00 GMT 2013


On Sun, Feb 3, 2013 at 11:47 AM, David Brown <david.brown@hesbynett.no> wrote:
>
> Anyway, the simplest memory barrier in gcc is :
>
>         asm volatile("" ::: "memory");

That is a compilation level memory barrier, but it clearly does
nothing at the machine level.

To get a machine level (and compilation level) memory barrier using
current GCC, use
    __atomic_thread_fence (__ATOMIC_SEQ_CST);

Ian



More information about the Gcc mailing list