Reordering with atomic

atomic_uint a_8;
int32_t g_70;
int32_t g_141;

int main (int, char *[]) {
  a_8.load () & a_8.load ();
  g_141 = g_70 != 0;
}

The reference trace for main is:

     a_8    0  4   ALoad 
     a_8    0  4   ALoad 
RaW* g_70   0  4   Load
WaW* g_141  0  4   Store
The trace generated by gcc --param allow-store-data-races=0 -O3 is:
     g_70   0  4   Load
     a_8    0  4   ALoad 
     a_8    0  4   ALoad 
     g_141  0  4   Store
This reordering cannot be observed by a context. However a gcc invariant is never reorder with an atomic access.

Current status: fixed - r190941 (rth).


back