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]

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/


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