[Bug target/59767] __atomic_load_n with __ATOMIC_SEQ_CST should result in a memory barrier

jamrial at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jul 2 16:35:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59767

James Almer <jamrial at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamrial at gmail dot com

--- Comment #1 from James Almer <jamrial at gmail dot com> ---
This still happens with gcc 4.9 and gcc 5.

int foo(int *bar)
{
    return *bar;
}

and

int foo(int *bar)
{
    return __atomic_load_n(bar, __ATOMIC_SEQ_CST);
}

Generate the exact same assembly. The latter should add an mfence before the
mov instruction.



More information about the Gcc-bugs mailing list