Test Cases:
(attached)
Iteration code:
(...)
typedef TarjanSCC_iterator<CallGraph*> MyTarjan;
CallGraph& callGraph = getAnalysis<CallGraph>();
MyTarjan iter = tarj_begin(&callGraph);
MyTarjan end = tarj_end(&callGraph);
while(iter!=end)
iter++;
(...)
if you take the time to print out the function each non-looping node iter
traverses, it never reaches main...
Thanks,
Dave
On Fri, 6 Dec 2002, Chris Lattner wrote:
> > Recently I incorporated code into my project such that function
pointers
> > were supported, however it seems that the TarjanSCC_iterator no longer
> > works on the call graph... main() is no longer reached while the
function
> > pointers are... I can provide code, but I have a feeling there is a
> > simple fix... Has anyone gone through this?
>
> I'll need some more details before I can help. I assume this has to do
> with data structure analysis? Can you provide a testcase?
>
> -Chris
>
>
-------------- next part --------------
#include <stdlib.h>
#include <stdio.h>
//#define WORKS
int * a_global;
int a_predicate = 1;
int another_pred =0;
int func_one()
{
return 1;
}
int func_two()
{
return 2;
}
int func_three()
{
return 3;
}
int main()
{
int (*func_ptr)();
if(a_predicate)
func_ptr = func_one;
else if(another_pred)
func_ptr = func_two;
else
func_ptr = func_three;
#ifdef WORKS
return func_one();
#else
return func_ptr();
#endif
}