On Wed, Mar 27, 2013 at 3:13 AM, Nikhil Patil <nikhilpatil3...@gmail.com> wrote:
> 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?

Without a compilable testcase I can't explain, but obviously
'ptr1' is not an SSA name and points-to information is only
preserved for SSA names, not for any other variables that
are part of the solving process.

Richard.

>
> --
> Thanks,
> Nikhil Patil.

Reply via email to