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]

FW: Problem with reordering of memory accesses


Oops, I just realized that I had send this reply to a list subscriber...
I'm used to lists where the reply defaults to the list itself.
Sorry Mr Schirmer.
Here it is again:

> >   p->x4 = 0x12345678;
> >   __asm__ volatile("":::"memory"); 
> >   p->x2 = 0x87654321;
> 
> To stick with plain C, you probably could also use:
> 
> if ((p->x4 = 0x12345678) && (p->x2 = 0x87654321)) {}
> 
> or, if it is legal (I think it is):
> 
> (p->x4 = 0x12345678) && (p->x2 = 0x87654321);
> 
> the expression would have to include other tests in order to
> ensure both parts are always done, if the assignments were to
> include potential zeros
> this may seem a bit kludgey though
> 
> -- 
> Lyrian 
> 

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