Problem with reordering of memory accesses

Hartmut Schirmer hartmut.schirmer@arcormail.de
Tue Oct 17 10:03:00 GMT 2000


On Tue, 17 Oct 2000, Michael Schwingen wrote:
>How do I ensure that the writes occur in the specified order?  

Use a memory barrier:

  p->x4 = 0x12345678;
  __asm__ volatile("":::"memory"); 
  p->x2 = 0x87654321;

GCC should move a memory access across the asm statement.

Hartmut


More information about the Gcc mailing list