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]

Re: How to access points-to information for function pointers


On April 25, 2014 5:54:09 PM CEST, Swati Rathi <swatirathi@cse.iitb.ac.in> wrote:
>Hello,
>
>I am trying to print points-to information for SSA variables as below.
>
>   for (i = 1; i < num_ssa_names; i++)
>     {
>       tree ptr = ssa_name (i);
>       struct ptr_info_def *pi;
>
>       if (ptr == NULL_TREE
>           || SSA_NAME_IN_FREE_LIST (ptr))
>         continue;
>
>       pi = SSA_NAME_PTR_INFO (ptr);
>       if (pi)
>         dump_points_to_info_for (file, ptr);
>     }
>
>-------------------------------------------------------------
>My test program is given below :
>
>int main()
>{
>   int *p, i, j;
>   void (*fp1)();
>
>   if (i)
>   {
>     p = &i;
>     fp1 = fun1;
>   }
>else
>   {
>     p = &j;
>     fp1 = fun2;
>   }
>
>fp1();
>
>   printf ("\n%d %d\n", *p, i);
>   return 0;
>}
>-------------------------------------------------------------
>I get the output as :-
>
>p_1, points-to vars: { i j }
>fp1_2, points-to vars: { }
>-------------------------------------------------------------
>
>Why is the pointees for function pointer not getting dumped?

It's just not saved.

>How can I access this information?
>
>
>Regards,
>Swati



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