__atomic_load doesn't match ACQUIRE memory model

Bug #1084010 reported by Yvan Roux
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Undecided
Yvan Roux

Bug Description

Compiling this code for ARMv7

int v;

int foo()
{
  return __atomic_load_n (&v, __ATOMIC_ACQUIRE);
}

generates a data memory barrier defore the load:

foo:
    movw r3, #:lower16:v
    movt r3, #:upper16:v
    dmb sy
    ldr r0, [r3, #0]
    bx lr

But, the `Acquire’ semantics imply that no reads in the current thread
dependent on the value currently loaded can be reordered before this load.
Thus, the barrier needs to be after the load and not before.

This problem is referenced in GCC PR http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55492

Revision history for this message
Yvan Roux (yvan-roux) wrote :

Fix commited upstream r194490 and 194504

Changed in gcc-linaro:
assignee: nobody → Yvan Roux (yvan-roux)
status: New → In Progress
milestone: none → 4.7-2013.01
Yvan Roux (yvan-roux)
Changed in gcc-linaro:
status: In Progress → Fix Committed
Changed in gcc-linaro:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.