This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problem with reordering of memory accesses


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]