This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Alias-analysis in gccint
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 11 Dec 2007 00:11:29 +0800
- Subject: Alias-analysis in gccint
When I read the example of alias analysis from
http://gcc.gnu.org/onlinedocs/gccint/Alias-analysis.html, I could not
understand it. Here is this example and text,
"For instance, consider the following function:
foo (int i)
{
int *p, *q, a, b;
if (i > 10)
p = &a;
else
q = &b;
*p = 3;
*q = 5;
a = b + 2;
return *p;
}
After aliasing analysis has finished, the symbol memory tag for pointer
p will have two aliases, namely variables a and b. Every time pointer p
is dereferenced, we want to mark the operation as a potential reference
to a and b".
My questions is
How many aliases do p have? According to the doc here, it is
said that "p will have two aliases, namely variables a and b." What I
learned from compiler book is that p points-to &a, and q points-to &b.
Best Regards
--
Yao Qi <qiyaoltc AT gmail DOT com> GNU/Linux Developer
http://duewayqi.googlepages.com/