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]
Other format: [Raw text]

Re: [RFC] ignoring type alias conflicts between structures andscalars


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"
:)



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