[cfe-dev] -ast-print-xml hasUninstantiatedDefaultArg assert

Douglas Gregor dgregor at apple.com
Mon Nov 1 13:37:38 PDT 2010


On Nov 1, 2010, at 1:07 PM, Garrison Venn wrote:

> On OS X (10.6.x) when running (with trunk revision: 117928):
> 
> clang++ -cc1 -ast-print-xml unparsedDefaultArg.cc 
> 
> produces the following partial stack dump with:
> 
> Assertion failed: (!hasUninstantiatedDefaultArg() && "Default argument is not yet instantiated!"), function getDefaultArg, file llvm/tools/clang/lib/AST/Decl.cpp, line 1092.
> 0  clang++           0x000000010120978b PrintStackTrace(void*) + 38
> 1  clang++           0x0000000101209d46 SignalHandler(int) + 254
> 2  libSystem.B.dylib 0x00007fff812e635a _sigtramp + 26
> 3  libSystem.B.dylib 0x0000000104c4dc65 _sigtramp + 2207676709
> 4  clang++           0x000000010002099f raise + 27
> 5  clang++           0x00000001000209af abort + 14
> 6  clang++           0x0000000100020a3c __gnu_cxx::new_allocator<std::pair<void (*)(void*), void*> >::new_allocator() + 0
> 7  clang++           0x00000001006bbda8 clang::ParmVarDecl::getDefaultArg() + 138
> 8  clang++           0x0000000100079831 clang::DocumentXML::DeclPrinter::addSubNodes(clang::ParmVarDecl*) + 25
> 9  clang++           0x000000010007994f clang::DocumentXML::DeclPrinter::VisitParmVarDecl(clang::ParmVarDecl*) + 249
> 10 clang++           0x0000000100079eab clang::DeclVisitor<clang::DocumentXML::DeclPrinter, void>::Visit(clang::Decl*) + 1055
> 11 clang++           0x000000010007a803 clang::DocumentXML::DeclPrinter::addSubNodes(clang::FunctionDecl*) + 61
> 12 clang++           0x000000010007aee2 clang::DocumentXML::DeclPrinter::VisitCXXMethodDecl(clang::CXXMethodDecl*) + 858
> ...
> 
> 
> such that unparsedDefaultArg.cc ==
> 
> ---------------------- START --------------------------------
> #include <string>
> 
> int main (int argc, char* argv[])
> {
>    return(0);
> }
> ----------------------- END -------------------------------
> 
> Same result occurs with a release build, and when building on Linux (32bit on ec2, clang+llvm
> built with gcc4.2.1 and -m686).
> 
> I do not yet have the proficiency in Clang internals to debug this, but pointers 
> in this direction would help mitigate my time. Specifically given that I need to
> search for a parameter with a default arg, is there a symbol one could give
> me which I could use in gdb to dump the current source (SourceLocation/SourceRange?)
> at frame 7 above?

SourceLocation::dump(SourceManager&) will dump a source location in a human-readable format.

	- Doug



More information about the cfe-dev mailing list