<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'><style>p { margin: 0; }</style><div style="font-family: Times New Roman; font-size: 12pt; color: #000000">I am finding some weird behavior in the CallGraph, and am not sure what am I doing wrong. When trying to traverse nodes<br>in the CallGraph I get stuck in nodes representing external functions. Take the following code:<br><br>-----<br><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">#include <stdio.h></span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">int main() {</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">  printf( "Hello World!\n" );</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">}</span><br>-----<br><br>If I try to traverse the CallGraph using the following code:<br><br>-----<br><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">CallGraph CG = this->getAnalysis<CallGraph>();</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">for( CallGraph::const_iterator i = CG.begin(); i != CG.end(); ++i ) {</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">        CallGraphNode * cgn = i->second;</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">        for( CallGraphNode::const_iterator ii = cgn->begin();</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">          ii != cgn->end(); ++ii ) {}</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">}</span><br>-----<br><br>The CallGraphNode::const_iterator is inconsistent. For starters, the inner loop never exits and, besides, if I<br>try to use the values contained in the iterator (e.g. ii->second) I get segfaults. Calling CG.dump() works<br>flawlessly,  but mimicking the code from CG.dump() in my user code produces inconsistent CGN iterators<br>again. I am at a loss here, any ideas?<br><br>Best,<br>Gabriel<br><br>PS: I have already added the CallGraph analysis to the pass requirements.<br></div></div></body></html>