This is the mail archive of the gcc-bugs@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]

Re: neat bug in alias analysis


mark@codesourcery.com (Mark Mitchell) writes:

> >>>>> "Mike" == Mike Stump <mrs@wrs.com> writes:
> 
>     >> From: Mark Mitchell <mark@codesourcery.com> Date: Thu, 19 Aug
>     >> 1999 14:45:35 -0700
> 
>     >> + Note that this approach is actually more conservative that it
>     >> + needs to be.  In particular, `const int *' and `int *' should
>     >> + be in different alias sets, but this approach puts them in +
>     >> the same alias set.  */
> 
>     Mike> Again, I still question the truth of this.  I think the
>     Mike> comment is plain wrong.  I would like to have it explained
>     Mike> to me, see my previous email.
> 
> I already tried in an earlier email.  The point is that the types we
> are looking at here are the types of the memory being referenced, not
> the types that we are using to reference it.  An `int **' cannot point
> at the same thing as a `const int **' as `int *' and `const int *' are
> not compatible types.  So, `const int*' and `int *' should be in
> different alias sets.

So what was wrong with the example Mike provided, which was basically:

inline int do_with_p(const int *p) 
{
        return *p + 1; 
}

int func(void) 
{
        int t = 1;
        return do_with_p(&t); 
}

After the inlining *p and t are the same in the same function and need to be 
in the same alias class. 


-Andi

-- 
This is like TV. I don't like TV.


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