[LLVMbugs] [Bug 18633] New: Assertion failed: (T::isKind(*this)), function castAs, file tools/clang/include/clang/AST/TypeLoc.h, line 54.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 27 11:34:28 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18633

            Bug ID: 18633
           Summary: Assertion failed: (T::isKind(*this)), function castAs,
                    file tools/clang/include/clang/AST/TypeLoc.h, line 54.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11951
  --> http://llvm.org/bugs/attachment.cgi?id=11951&action=edit
Test case for quantis typeloc assertion failure

Koop Mast (kwm at FreeBSD.org) pointed me at the following clang assertion in a
build log for the Quantis port:

http://beefy1.isc.freebsd.org/bulk/head-i386-default/2014-01-23_09h31m52s/logs/quantis-v13.04.29.log

This turns out to be some weird parser problem, which only occurs when
assertions are enabled.  Thanks to creduce, I was able to reduce this to a 527
byte test case.

Simply compile with clang -c, which will produce a lot of (uninteresting)
errors, then die with:

Assertion failed: (T::isKind(*this)), function castAs, file
tools/clang/include/clang/AST/TypeLoc.h, line 54.
Stack dump:
0.      Program arguments: clang -cc1 -triple i386-unknown-freebsd11.0
-emit-obj -mrelax-all -disable-free -main-file-name quantis-reduced.cpp
-mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases
-target-cpu i486 -coverage-file quantis-reduced.o -internal-isystem
/usr/include/c++/v1 -w -fdeprecated-macro -ferror-limit 19 -fmessage-length 340
-mstackrealign -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o
quantis-reduced.o -x c++ quantis-reduced.cpp
1.      <eof> parser at end of file
2.      quantis-reduced.cpp:10:7: instantiating function definition
'GenerateFormattedFile'

The stack trace goes approximately like this:
#0  0x2a21b956 in __assert () from /lib/libc.so.7
#1  0x09747cde in clang::VariableArrayTypeLoc
clang::TypeLocBuilder::push<clang::VariableArrayTypeLoc>(clang::QualType) ()
#2  0x098b430e in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
clang::TypeLoc) ()
#3  0x098b366c in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*) ()
#4  0x098b3507 in clang::Sema::SubstType(clang::TypeSourceInfo*,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName) ()
#5  0x098de43e in
clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*, bool) ()
#6  0x098de350 in
clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*) ()
#7  0x098e6de8 in clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*,
clang::MultiLevelTemplateArgumentList const&) ()
#8  0x098d60c6 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformDeclStmt(clang::DeclStmt*) ()
#9  0x098bdd40 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) ()
#10 0x098d211b in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) ()
#11 0x098d5fc0 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*)
()
#12 0x098bdd18 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) ()
#13 0x098bdbad in clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) ()
#14 0x098ec230 in
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) ()
#15 0x098ed5d9 in clang::Sema::PerformPendingInstantiations(bool) ()
#16 0x0959b877 in clang::Sema::ActOnEndOfTranslationUnit() ()
#17 0x09418ab1 in
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) ()
#18 0x09414772 in clang::ParseAST(clang::Sema&, bool, bool) ()
#19 0x08dfa180 in clang::ASTFrontendAction::ExecuteAction() ()
#20 0x0922a473 in clang::CodeGenAction::ExecuteAction() ()
#21 0x08df9a9d in clang::FrontendAction::Execute() ()
#22 0x08dd738d in
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ()
#23 0x08e67a28 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) ()
#24 0x0832099d in cc1_main(char const**, char const**, char const*, void*) ()
#25 0x0831e36a in main ()

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140127/f5ae1964/attachment.html>


More information about the llvm-bugs mailing list