[LLVMbugs] [Bug 11743] New: Segfault in slightly crazy invalid code
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jan 11 05:33:23 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=11743
Bug #: 11743
Summary: Segfault in slightly crazy invalid code
Product: clang
Version: trunk
Platform: PC
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: chris at bubblescope.net
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
It is getting much harder to fuzz clang into crashing than it used to be, and
the resulting code is much crazier looking (which is good). The following
(invalid) code causes clang to segfault. It seems to be the malformed
destructor call which is to blame.
template <int> struct integral_constant ;
template <int>
int d() ;
template <int _T>
struct X : integral_constant<d<_T>().~_T >
{ };
t.cc:6:30: error: pseudo-destructor expression must be called immediately with
'()'
struct X : integral_constant<d<_T>().~_T >
^
()
Assertion failed: (!isNull() && "Cannot retrieve a NULL type pointer"),
function getCommonPtr, file
/Users/caj/work/code/clang/llvm/tools/clang/lib/Sema/../../include/clang/AST/Type.h,
line 478.
0 clang 0x0000000102f2152e _ZL15PrintStackTracePv + 46
1 clang 0x0000000102f21ad9 _ZL13SignalHandleri + 297
2 libsystem_c.dylib 0x00007fff8ce36cfa _sigtramp + 26
3 libsystem_c.dylib 0x0000040001354634 _sigtramp + 18446607736219228500
4 clang 0x0000000102f217fb raise + 27
5 clang 0x0000000102f218b2 abort + 18
6 clang 0x0000000102f21891 __assert_rtn + 129
7 clang 0x00000001013469d1 clang::QualType::getCommonPtr() const +
97
8 clang 0x0000000101353f69 clang::QualType::getCanonicalType()
const + 25
9 clang 0x00000001013439fc
clang::ASTContext::getCanonicalType(clang::QualType) const + 28
10 clang 0x0000000101e5e17b (anonymous
namespace)::StmtProfiler::VisitType(clang::QualType) + 59
11 clang 0x0000000101e5be26 (anonymous
namespace)::StmtProfiler::VisitCXXPseudoDestructorExpr(clang::CXXPseudoDestructorExpr
const*) + 134
12 clang 0x0000000101e59ccd
clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::StmtProfiler, void>::Visit(clang::Stmt const*) + 2189
13 clang 0x0000000101e5de76 (anonymous
namespace)::StmtProfiler::VisitStmt(clang::Stmt const*) + 118
14 clang 0x0000000101e5e26d (anonymous
namespace)::StmtProfiler::VisitExpr(clang::Expr const*) + 29
15 clang 0x0000000101e5c00d (anonymous
namespace)::StmtProfiler::VisitCallExpr(clang::CallExpr const*) + 29
16 clang 0x0000000101e59d75
clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::StmtProfiler, void>::Visit(clang::Stmt const*) + 2357
17 clang 0x0000000101e593fa
clang::Stmt::Profile(llvm::FoldingSetNodeID&, clang::ASTContext const&, bool)
const + 90
18 clang 0x0000000101e63738
clang::TemplateArgument::Profile(llvm::FoldingSetNodeID&, clang::ASTContext
const&) const + 568
19 clang 0x0000000101e7221f
clang::TemplateSpecializationType::Profile(llvm::FoldingSetNodeID&,
clang::TemplateName, clang::TemplateArgument const*, unsigned int,
clang::ASTContext const&) + 95
20 clang 0x0000000101ca107c
clang::ASTContext::getCanonicalTemplateSpecializationType(clang::TemplateName,
clang::TemplateArgument const*, unsigned int) const + 572
21 clang 0x0000000101ca0cba
clang::ASTContext::getTemplateSpecializationType(clang::TemplateName,
clang::TemplateArgument const*, unsigned int, clang::QualType) const + 458
22 clang 0x00000001015c9159
clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation,
clang::TemplateArgumentListInfo&) + 1577
23 clang 0x00000001015caa00
clang::Sema::ActOnTemplateIdType(clang::CXXScopeSpec&,
clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation,
clang::SourceLocation, clang::ASTTemplateArgsPtr, clang::SourceLocation) + 912
24 clang 0x000000010130a9d6
clang::Parser::AnnotateTemplateIdTokenAsType() + 454
25 clang 0x00000001012ca606
clang::Parser::ParseBaseTypeSpecifier(clang::SourceLocation&,
clang::SourceLocation&) + 934
26 clang 0x00000001012ce442
clang::Parser::ParseBaseSpecifier(clang::Decl*) + 402
27 clang 0x00000001012ce172
clang::Parser::ParseBaseClause(clang::Decl*) + 178
28 clang 0x00000001012cd68d
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::Decl*) + 925
29 clang 0x00000001012ccc35
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, bool) + 7813
30 clang 0x00000001012b7e32
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 7842
31 clang 0x0000000101307af7
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&,
clang::AccessSpecifier, clang::AttributeList*) + 471
32 clang 0x0000000101307663
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 1299
33 clang 0x0000000101307064
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 212
34 clang 0x00000001012b5b64
clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&) + 388
35 clang 0x0000000101312ea6
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 1910
36 clang 0x00000001013126e9
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 361
37 clang 0x00000001012acff2 clang::ParseAST(clang::Sema&, bool) +
338
38 clang 0x0000000100f85878
clang::ASTFrontendAction::ExecuteAction() + 264
39 clang 0x000000010124ae7b clang::CodeGenAction::ExecuteAction() +
1051
40 clang 0x0000000100f854c7 clang::FrontendAction::Execute() + 199
41 clang 0x0000000100f52104
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 884
42 clang 0x0000000100f244f1
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 961
43 clang 0x0000000100f0e725 cc1_main(char const**, char const**,
char const*, void*) + 965
44 clang 0x0000000100f1e429 main + 473
45 clang 0x0000000100f0e334 start + 52
Stack dump:
0. Program arguments: /assert-clang/bin/clang -cc1 -triple
x86_64-apple-macosx10.7.2 -emit-obj -mrelax-all -disable-free -main-file-name
t.cc -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu
core2 -target-linker-version 123.2.1 -coverage-file t.o -resource-dir
/assert-clang/bin/../lib/clang/3.1 -fmodule-cache-path
/var/folders/c2/j2pf8rdj4w1dr624t90z2q700000gn/T/clang-module-cache
-fdeprecated-macro -fdebug-compilation-dir /Users/caj/temp -ferror-limit 19
-fmessage-length 138 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
t.o -x c++ t.cc
1. t.cc:6:12: at annotation token
2. t.cc:6:1: parsing struct/union/class body 'X'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg:
/var/folders/c2/j2pf8rdj4w1dr624t90z2q700000gn/T/t-cSv4Of.ii
clang: note: diagnostic msg:
/var/folders/c2/j2pf8rdj4w1dr624t90z2q700000gn/T/t-cSv4Of.sh
~/temp$
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list