This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
FW: Problem with reordering of memory accesses
- To: <gcc at gcc dot gnu dot org>
- Subject: FW: Problem with reordering of memory accesses
- From: "Vincent Penquerc'h" <vincent at qubesoft dot com>
- Date: Wed, 18 Oct 2000 17:34:07 -0000
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
>