This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] ignoring type alias conflicts between structures andscalars
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Diego Novillo <dnovillo at redhat dot com>
- Cc: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 25 Nov 2004 11:53:40 -0500
- Subject: Re: [RFC] ignoring type alias conflicts between structures andscalars
- References: <10411251622.AA06167@vlsi1.ultra.nyu.edu> <1101400529.31231.105.camel@localhost.localdomain>
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"
:)