[PATCH] Tree SRA and atomicity/volatility

Richard Guenther richard.guenther@gmail.com
Sun Jan 14 14:57:00 GMT 2007


On 1/14/07, Eric Botcazou <ebotcazou@adacore.com> wrote:
> > for this testcase (t02.original dump, gcc 4.1.2) .  Now if I change the
> > testcase to something I requested (direct write to a component), I get
> >
> > Q ()
> > {
> >   typedef q__byte q__byte;
> >   typedef struct q__word q__word;
> >   struct q__word T1b = {.first=0, .second=0, .third=0, .fourth=0};
> >   struct q__word external = VIEW_CONVERT_EXPR<struct q__word>(SAVE_EXPR
> > <T1b>);
> >
> >   VIEW_CONVERT_EXPR<struct q__word>(external).first = 0;
> >   return;
> > }
>
> You mean this I presume?
>
> External.First = 0;
>
> Then it is legal for the compiler to emit
>
>         movb    $0, -4(%ebp)
>
> because the object is not accessed "as a whole" in the source code (see the RM
> quote in my first message).

So my Ada ignorance shows here - so "atomicity" of External is only
guaranteed for copies.  Still there is nothing "clever" that gigi is doing -
it's simply doing structure assignment (with some useless
VIEW_CONVERT_EXPRs).  I think you should represent this atomic
access via a union.  But I wonder for what this form of "atomicity" is
used or useful.

Richard.



More information about the Gcc-patches mailing list