<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 3 January 2013 17:38, Johannes Pfau <span dir="ltr"><<a href="mailto:nospam@example.com" target="_blank">nospam@example.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Am Thu, 3 Jan 2013 16:47:00 +0000<br>
schrieb Iain Buclaw <<a href="mailto:ibuclaw@ubuntu.com">ibuclaw@ubuntu.com</a>>:<br>
<div class="im"><br>
> On 3 January 2013 16:12, Johannes Pfau <<a href="mailto:nospam@example.com">nospam@example.com</a>> wrote:<br>
><br>
</div><div class="im">> > Then there's the question why the outer function has to be a<br>
> > template as well for this to happen: It's because if it's not a<br>
> > template, gdc uses a completely different code path: There's a<br>
> > "!gen.functionNeedsChain (f)" check in outputFunction which is false<br>
> > for the failing case. (cgraph_finalize_function marks the function<br>
> > as reachable)<br>
> ><br>
> ><br>
</div><div class="im">> That might be just it then...<br>
<br>
</div>I admit I don't really know why this check is needed but even if I try<br>
to call cgraph_finalize_function for indirectLess the backend dies with<br>
the same error. Actually my statement above was wrong,<br>
cgraph_finalize_function only marks the function as reachable if it's<br>
TREE_PUBLIC/. The not-templated case works even without<br>
cgraph_finalize_function so that's not the issue.<br>
<br></blockquote><div><br></div><div>I would have thought that it be a little more factors than that.  Remember, TREE_PUBLIC only means whether or not the function is callable outside of the module we are compiling (TREE_PUBLIC=0 means that the function is not marked as global in the assembly output).<br>
</div><div><br></div><div>I think it would be a mixture between what DECL_CONTEXT is set for the affected functions, and the order that the functions generated are passed to cgraph_finalize_function.<br></div><div><br><br>
 </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
><br>
> I have been rolling round my head to remove the notion of functions<br>
> nested in functions within the D codegen.  Having only RECORD and<br>
> UNION types set in DECL_CONTEXT.  So all public functions are<br>
> TREE_PUBLIC=1 (unless there's some overriding attribute), and all<br>
> nested functions are TREE_PUBLIC=0.<br>
<br>
</div>I see! That's why percolateDown is public, but isn't it essentially a<br>
nested function in the test case?<br>
<br></blockquote></div><br></div><div class="gmail_extra">What I said was an idea that *could* be implemented, but is not yet.<br><br></div><div class="gmail_extra">See ObjectFile::setupSymbolStorage for why templates are public by default...<br>
</div><div class="gmail_extra"><br>-- <br>Iain Buclaw<br><br>*(p < e ? p++ : p) = (c & 0x0f) + '0';
</div></div>