[LLVMbugs] [Bug 15895] New: Crash-on-invalid in template diffing code
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed May 1 20:54:57 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=15895
Bug ID: 15895
Summary: Crash-on-invalid in template diffing code
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: nicolasweber at gmx.de
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
At trunk of this morning (r180855), but also an issue with the clang in Xcode
4.6:
Nicos-MacBook-Pro:delta thakis$ cat repro.ii
class ActionBase {
public:
virtual void DeleteExpr(void *E) {}
virtual void DeleteDecl(void *S) {}
};
typedef void(ActionBase::*ASTDestroyer)(void *);
template <ASTDestroyer Destroyer> class ASTOwningResult {
};
class Action : public ActionBase {
public:
typedef ASTOwningResult< &ActionBase::DeleteExpr> OwningExprResult;
typedef ASTOwningResult< &ActionBase::DeleteDecl> OwningDeclResult;
virtual OwningDeclResult ActOnTypeName() {}
};
class Parser {
typedef Action::OwningExprResult OwningExprResult;
class IdentOrTypeList {
void ToTypes() {
Action Actions;
OwningExprResult R(Actions.ActOnTypeName());
}
};
};
Nicos-MacBook-Pro:delta thakis$
/Users/thakis/src/llvm/Release+Asserts/bin/clang -c repro.ii -m32
repro.ii:15:45: warning: control reaches end of non-void function
[-Wreturn-type]
virtual OwningDeclResult ActOnTypeName() {}
^
repro.ii:22:24: error: no matching constructor for initialization of
'OwningExprResult' (aka 'ASTOwningResult<&ActionBase::DeleteExpr>')
OwningExprResult R(Actions.ActOnTypeName());
^ ~~~~~~~~~~~~~~~~~~~~~~~
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"),
function cast, file /Users/thakis/src/llvm/include/llvm/Support/Casting.h, line
237.
0 clang 0x0000000101b65418 llvm::sys::PrintStackTrace(__sFILE*) +
40
1 clang 0x0000000101b65974 SignalHandler(int) + 548
2 libsystem_c.dylib 0x00007fff8b84894a _sigtramp + 26
3 libsystem_c.dylib 0x00007ff400000000 _sigtramp + 1954248400
4 clang 0x0000000101b65736 abort + 22
5 clang 0x0000000101b65711 __assert_rtn + 81
6 clang 0x0000000100d59926 (anonymous
namespace)::TemplateDiff::GetValueDecl((anonymous
namespace)::TemplateDiff::TSTiterator const&, clang::Expr*) + 182
7 clang 0x0000000100d58282 (anonymous
namespace)::TemplateDiff::DiffTemplate(clang::TemplateSpecializationType
const*, clang::TemplateSpecializationType const*) + 3938
8 clang 0x0000000100d5326d
clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind,
long, char const*, unsigned int, char const*, unsigned int,
std::pair<clang::DiagnosticsEngine::ArgumentKind, long> const*, unsigned int,
llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>) + 2877
9 clang 0x0000000100ea7abd
clang::Diagnostic::FormatDiagnostic(char const*, char const*,
llvm::SmallVectorImpl<char>&) const + 5085
10 clang 0x00000001003d24a3
clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level,
clang::Diagnostic const&) + 115
11 clang 0x0000000100eab8b9
clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const + 585
12 clang 0x0000000100ea6589
clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) + 89
13 clang 0x00000001006cf9cf
clang::Sema::EmitCurrentDiagnostic(unsigned int) + 831
14 clang 0x00000001008d31c1 clang::(anonymous
namespace)::DiagnoseBadConversion(clang::Sema&, clang::OverloadCandidate*,
unsigned int) + 8561
15 clang 0x00000001008b72e0
clang::OverloadCandidateSet::NoteCandidates(clang::Sema&,
clang::OverloadCandidateDisplayKind, llvm::ArrayRef<clang::Expr*>,
llvm::StringRef, clang::SourceLocation) + 4704
16 clang 0x000000010087b7f8
clang::InitializationSequence::Diagnose(clang::Sema&, clang::InitializedEntity
const&, clang::InitializationKind const&, clang::Expr**, unsigned int) + 7736
17 clang 0x0000000100876a2a
clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity
const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>,
clang::QualType*) + 282
18 clang 0x000000010076031b
clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool, bool) +
3387
19 clang 0x0000000100631955
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 1829
20 clang 0x0000000100630105
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1861
21 clang 0x000000010062c6ae
clang::Parser::ParseSimpleDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*)
+ 590
22 clang 0x000000010062c3b4
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 964
23 clang 0x000000010067eca1
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2337
24 clang 0x000000010067e2ea
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 154
25 clang 0x0000000100685a32
clang::Parser::ParseCompoundStatementBody(bool) + 1666
26 clang 0x000000010068742e
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 190
27 clang 0x0000000100623437
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 599
28 clang 0x0000000100622c25
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 197
29 clang 0x0000000100622c25
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 197
30 clang 0x00000001006482f7
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 4663
31 clang 0x00000001006462b8
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 7544
32 clang 0x000000010062d960
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 4560
33 clang 0x0000000100696429
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 73
34 clang 0x00000001006960df
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 351
35 clang 0x00000001006955fc
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 3020
36 clang 0x00000001006949b4
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 308
37 clang 0x0000000100620906 clang::ParseAST(clang::Sema&, bool,
bool) + 438
38 clang 0x00000001005dbb57 clang::CodeGenAction::ExecuteAction() +
215
39 clang 0x00000001003a77a7 clang::FrontendAction::Execute() + 119
40 clang 0x000000010038372d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 957
41 clang 0x000000010034e09a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3690
42 clang 0x0000000100345230 cc1_main(char const**, char const**,
char const*, void*) + 816
43 clang 0x000000010034b3b9 main + 7049
44 libdyld.dylib 0x00007fff89e4c7e1 start + 0
45 libdyld.dylib 0x0000000000000030 start + 1981495375
Stack dump:
0. Program arguments: /Users/thakis/src/llvm/Release+Asserts/bin/clang -cc1
-triple i386-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free
-main-file-name repro.ii -mrelocation-model pic -pic-level 2 -mdisable-fp-elim
-masm-verbose -target-cpu yonah -target-linker-version 136 -coverage-file
/Users/thakis/src/delta/repro.o -resource-dir
/Users/thakis/src/llvm/Release+Asserts/bin/../lib/clang/3.3 -fdeprecated-macro
-fdebug-compilation-dir /Users/thakis/src/delta -ferror-limit 19
-fmessage-length 230 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-fragile-10.8.0 -fobjc-default-synthesize-properties
-fencode-extended-block-signature -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops
-o repro.o -x c++-cpp-output repro.ii
1. repro.ii:22:50: current parser token ';'
2. repro.ii:17:1: parsing struct/union/class body 'Parser'
3. repro.ii:20:20: parsing function body 'ToTypes'
4. repro.ii:20:20: in compound statement ('{}')
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.3 (trunk 180855)
Target: i386-apple-darwin12.3.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.
--
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/20130502/ab9257e6/attachment.html>
More information about the llvm-bugs
mailing list