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, Oct 17, 2000 at 06:44:46PM +0200, Hartmut Schirmer wrote:
> 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.
            ^ not?

This looks good. However, I would prefer a compiler-independent / portable
solution if there exists one.

cu
Michael

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