FW: Problem with reordering of memory accesses

Vincent Penquerc'h vincent@qubesoft.com
Wed Oct 18 09:33:00 GMT 2000


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 
> 


More information about the Gcc mailing list