[LLVMdev] incorrect DSCallGraph for simple indirect call with vtable nearby

Ben Liblit liblit at cs.wisc.edu
Thu Aug 11 19:21:31 PDT 2011


Will Dietz wrote:
> In C the red() and blue() declarations are var-args functions, in C++
> they're void.  This difference is behind the IR you posted, and the
> function pointer cast required in the C version.

Ah, right.  Subtle!

> Anyway, one such arguably
> illegal pairing is a varargs/nonvarargs mismatch between callsite and
> callee, and filtering on this is what's causing the results you're
> seeing.

In that case, in the example that I gave, it's hard to imagine what
possible call site would constitute a *legal* call to a function
declared as "void red()".  I do understand that "()" as an argument list
in C means that the number and types of arguments are unspecified.  But
shouldn't that mean that *any* call to such a function is legal?  It
seems here that there is no possible way to call such a function that
would not be treated as illegal and therefore be omitted from DSA's
callee results.

> Luckily(-ish), the types of filtering used are controlled by flags,
> and the flag for this option is "-dsa-no-filter-vararg".

Yay!  Thanks for pointing that out.

Meanwhile, what about the fact that even the C++ version, which does not
have this varargs issue, is marked as incomplete?  Where does DSA get
the idea that something other than red() or blue() could be called at
"(unknown ? red : blue)()"?  I'm quite surprised that the callee set for
this call site is not marked as complete.  Can you help me understand?

> Thanks for your detailed reports, and happy callgraph building :)

Thank *you* for your detailed explanations of DSA's behavior and helpful
suggestions for how to tweak it to better meet my needs!

Regards,
Ben



More information about the llvm-dev mailing list