neat bug in alias analysis
Mark Mitchell
mark@codesourcery.com
Tue Aug 31 22:45:00 GMT 1999
>>>>> "Andi" == Andi Kleen <ak@muc.de> writes:
>> 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.
Andi> So what was wrong with the example Mike provided, which was
Andi> basically:
Andi> inline int do_with_p(const int *p) { return *p + 1; }
Andi> int func(void) { int t = 1; return do_with_p(&t); }
Andi> After the inlining *p and t are the same in the same
Andi> function and need to be in the same alias class.
Yup. Apparently, I don't write very well.
Look, the *memory* referenced here is `*p' and `t'. One is an `int';
one is a `const int'. These have the same alias set.
However, there's no reason that `const int *' and `int *' should have
the same alias set.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the Gcc-bugs
mailing list