This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Problem in understanding points-to analysis
- From: Nikhil Patil <nikhilpatil3721 at gmail dot com>
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Wed, 27 Mar 2013 07:43:49 +0530
- Subject: Problem in understanding points-to analysis
Hello everyone,
I am trying to understand the points-to analysis ("pta") ipa pass, but
I am not able to match the information generated by the pass and that
in structure "SSA_NAME_PTR_INFO".
For the code segment,
----------------------------------------------
int var1, var2, var3, var4, *ptr1, *ptr2, **ptr3;
if (var1==10) {
ptr1 = &var1;
ptr2 = &var2;
}
else {
ptr1 = &var3;
ptr2 = &var4;
}
if (var2==3) {
ptr3 = &ptr1;
}
else {
ptr3 = &ptr2;
}
printf("\n %d %d \n",*ptr1, **ptr3);
----------------------------------------------
The points-to information in dump_file of "pta" pass:
ptr1.2_6 = { var1 var3 }
ptr1 = { var1 var3 } same as ptr1.2_6
But accessing the structure "SSA_NAME_PTR_INFO" (using API
dump_points_to_info_for(..) ) in a pass AFTER "pta", shows
ptr1.2_6, points-to vars: { var1 var3 }
ptr1, points-to anything
Why here 'ptr1' is not pointing to '{ var1 var3 }' as found by "pta"?
Can someone please help me understand this behaviour?
--
Thanks,
Nikhil Patil.