[RFC] ignoring type alias conflicts between structures and scalars
Daniel Berlin
dberlin@dberlin.org
Thu Nov 25 17:39:00 GMT 2004
On Thu, 2004-11-25 at 11:35 -0500, Diego Novillo wrote:
> On Thu, 2004-11-25 at 11:22 -0500, Richard Kenner wrote:
>
> > If I have two pointers, one to struct_int_float and one to int, it's
> > certainly the case that a store into one can affect what's pointed to by the
> > other and that's what the alias set conflict is trying to address.
> >
> No, we have one pointer and one regular variable. I understand that an
> 'int *' may point to a field of 'struct int_float_s'.
>
> > So what *exactly* are you trying to test?
> >
> It's in my original message. Given:
>
> struct int_float_s {
> int i;
> int f;
> };
>
> int X;
>
> foo()
> {
> struct int_float_s *x = bar();
> X = 10;
> x->i = 3;
> return X;
> }
>
> I don't want to consider 'X = 10' and 'x->i = 3' to be stores to the
> same memory location. That is, I want the optimizers to assume that
> pointer 'x' cannot possibly be pointing to 'X'.
These two statements are saying the same thing about two different
types.
(*x).i == int
X == int
Thus, they can alias, AFAIK
*x == struct int_float_s
X == int
Thus, they can't alias.
So while x can't alias with X, it can X can alias with x->i.
AFAIK.
--Dan
PS i like how you named a structure containing only ints "int_float_s"
:)
More information about the Gcc
mailing list