Debugging "missing callgraph edge for call stmt"

Johannes Pfau nospam at example.com
Thu Jan 3 09:38:55 PST 2013


Am Thu, 3 Jan 2013 16:47:00 +0000
schrieb Iain Buclaw <ibuclaw at ubuntu.com>:

> On 3 January 2013 16:12, Johannes Pfau <nospam at example.com> wrote:
> 
> > Then there's the question why the outer function has to be a
> > template as well for this to happen: It's because if it's not a
> > template, gdc uses a completely different code path: There's a
> > "!gen.functionNeedsChain (f)" check in outputFunction which is false
> > for the failing case. (cgraph_finalize_function marks the function
> > as reachable)
> >
> >
> That might be just it then...

I admit I don't really know why this check is needed but even if I try
to call cgraph_finalize_function for indirectLess the backend dies with
the same error. Actually my statement above was wrong,
cgraph_finalize_function only marks the function as reachable if it's
TREE_PUBLIC/. The not-templated case works even without
cgraph_finalize_function so that's not the issue.

The only other thing which worked was setting the cgraph
finalized flag manually and then explicitly calling
cgraph_mark_needed_node for indirectLess, but I don't think that's a
real solution.


> 
> I have been rolling round my head to remove the notion of functions
> nested in functions within the D codegen.  Having only RECORD and
> UNION types set in DECL_CONTEXT.  So all public functions are
> TREE_PUBLIC=1 (unless there's some overriding attribute), and all
> nested functions are TREE_PUBLIC=0.

I see! That's why percolateDown is public, but isn't it essentially a
nested function in the test case? 

It's in a template which is nested in a second function (topNIndex) and
it accesses a function(indirectLess) nested in that function by alias.
So isn't that the same as:
-topNIndex
----indirectLess
----percolateDown{indirectLess();} <--- nested function

(we have)
-topNIndex
----indirectLess
----BinaryHeap(alias indirectLess)
--------percolateDown{indirectLess()}; <--- is TREE_PUBLIC



More information about the D.gnu mailing list