[LLVMbugs] [Bug 7190] New: clang crashes trying to instantiate an invalid friend decl

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 21 14:23:53 PDT 2010


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

           Summary: clang crashes trying to instantiate an invalid friend
                    decl
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rideau3 at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


In the attached testcase, clang will attempt to instantiate the friend decl
which is invalid because Derived has not been declared.

Backtrace:

#0  0x080e87c1 in clang::TypeSourceInfo::getType (this=0x0) at
/home/coppro/code/c++/llvm/tools/clang/lib/Frontend/../../include/clang/AST/Decl.h:55
#1  0x0844123c in clang::Sema::SubstType (this=0xbfffe250, T=0x0, Args=...,
Loc=..., Entity=...) at SemaTemplateInstantiate.cpp:945
#2  0x08441696 in clang::Sema::SubstParmVarDecl (this=0xbfffe250,
OldParm=0x97bb970, TemplateArgs=...) at SemaTemplateInstantiate.cpp:1022
#3  0x08477102 in VisitParmVarDecl (this=0xbfff95e4, D=0x97bb970) at
SemaTemplateInstantiateDecl.cpp:1409
#4  0x08478a90 in SubstFunctionType (this=0xbfff95e4, D=0x97bb9c0, Params=...)
at SemaTemplateInstantiateDecl.cpp:1869
#5  0x084754bd in VisitFunctionDecl (this=0xbfff95e4, D=0x97bb9c0,
TemplateParams=0x0) at SemaTemplateInstantiateDecl.cpp:962
#6  0x0847b3ec in Visit (this=0xbfff95e4, D=0x97bb9c0) at
/home/coppro/code/c++/llvm/tools/clang/lib/Sema/../../include/clang/AST/DeclNodes.def:96
#7  0x08473b62 in VisitFriendDecl (this=0xbfff95e4, D=0x97bba20) at
SemaTemplateInstantiateDecl.cpp:528
#8  0x0847b69d in Visit (this=0xbfff95e4, D=0x97bba20) at
/home/coppro/code/c++/llvm/tools/clang/lib/Sema/../../include/clang/AST/DeclNodes.def:129
#9  0x0847800e in clang::Sema::SubstDecl (this=0xbfffe250, D=0x97bba20,
Owner=0x97bcbcc, TemplateArgs=...) at SemaTemplateInstantiateDecl.cpp:1655
#10 0x08441fb1 in clang::Sema::InstantiateClass (this=0xbfffe250,
PointOfInstantiation=..., Instantiation=0x97bcbb0, Pattern=0x97b70e8,
TemplateArgs=..., TSK=clang::TSK_ImplicitInstantiation, Complain=true) at
SemaTemplateInstantiate.cpp:1200
#11 0x0844283d in clang::Sema::InstantiateClassTemplateSpecialization
(this=0xbfffe250, PointOfInstantiation=..., ClassTemplateSpec=0x97bcbb0,
TSK=clang::TSK_ImplicitInstantiation, Complain=true) at
SemaTemplateInstantiate.cpp:1394
#12 0x084857be in clang::Sema::RequireCompleteType (this=0xbfffe250, Loc=...,
T=..., PD=..., Note=...) at SemaType.cpp:2063
#13 0x08485b5e in clang::Sema::RequireCompleteType (this=0xbfffe250, Loc=...,
T=..., PD=...) at SemaType.cpp:2114
#14 0x0839f8a8 in clang::Sema::ActOnCXXTypeConstructExpr (this=0xbfffe250,
TypeRange=..., TypeRep=0x97bbb28, LParenLoc=..., exprs=...,
CommaLocs=0xbfffb3c8, RParenLoc=...) at SemaExprCXX.cpp:515
#15 0x086bdc0b in clang::Parser::ParseCXXTypeConstructExpression
(this=0xbfffe9e0, DS=...) at ParseExprCXX.cpp:675
#16 0x086b5875 in clang::Parser::ParseCastExpression (this=0xbfffe9e0,
isUnaryExpression=false, isAddressOfOperand=false, NotCastExpr=@0xbfffbb8f,
TypeOfCast=0x0) at ParseExpr.cpp:785
#17 0x086b3637 in clang::Parser::ParseCastExpression (this=0xbfffe9e0,
isUnaryExpression=false, isAddressOfOperand=false, TypeOfCast=0x0) at
ParseExpr.cpp:403
#18 0x086b3d9a in clang::Parser::ParseCastExpression (this=0xbfffe9e0,
isUnaryExpression=false, isAddressOfOperand=false, NotCastExpr=@0xbfffc2cf,
TypeOfCast=0x0) at ParseExpr.cpp:609
#19 0x086b3637 in clang::Parser::ParseCastExpression (this=0xbfffe9e0,
isUnaryExpression=false, isAddressOfOperand=false, TypeOfCast=0x0) at
ParseExpr.cpp:403
#20 0x086b22ef in clang::Parser::ParseAssignmentExpression (this=0xbfffe9e0) at
ParseExpr.cpp:231
#21 0x086ba8e0 in clang::Parser::ParseExpressionList (this=0xbfffe9e0,
Exprs=..., CommaLocs=..., Completer=&virtual table offset 848, Data=0x97bba48)
at ParseExpr.cpp:1547
#22 0x086b6b4a in clang::Parser::ParsePostfixExpressionSuffix (this=0xbfffe9e0,
LHS=...) at ParseExpr.cpp:961
#23 0x086b423e in clang::Parser::ParseCastExpression (this=0xbfffe9e0,
isUnaryExpression=false, isAddressOfOperand=false, NotCastExpr=@0xbfffcd8f,
TypeOfCast=0x0) at ParseExpr.cpp:647
#24 0x086b3637 in clang::Parser::ParseCastExpression (this=0xbfffe9e0,
isUnaryExpression=false, isAddressOfOperand=false, TypeOfCast=0x0) at
ParseExpr.cpp:403
#25 0x086b22ef in clang::Parser::ParseAssignmentExpression (this=0xbfffe9e0) at
ParseExpr.cpp:231
#26 0x086b1c01 in clang::Parser::ParseExpression (this=0xbfffe9e0) at
ParseExpr.cpp:180
#27 0x086ba182 in clang::Parser::ParseParenExpression (this=0xbfffe9e0,
ExprType=@0xbfffd1b4, stopIfCastExpr=true, TypeOfCast=0x0, CastTy=@0xbfffd274,
RParenLoc=...) at ParseExpr.cpp:1462
#28 0x086b7821 in clang::Parser::ParseExprAfterTypeofSizeofAlignof
(this=0xbfffe9e0, OpTok=..., isCastExpr=@0xbfffd27f, CastTy=@0xbfffd274,
CastRange=...) at ParseExpr.cpp:1116
#29 0x086b7af1 in clang::Parser::ParseSizeofAlignofExpression (this=0xbfffe9e0)
at ParseExpr.cpp:1158
#30 0x086b503f in clang::Parser::ParseCastExpression (this=0xbfffe9e0,
isUnaryExpression=false, isAddressOfOperand=false, NotCastExpr=@0xbfffd9bf,
TypeOfCast=0x0) at ParseExpr.cpp:721
#31 0x086b3637 in clang::Parser::ParseCastExpression (this=0xbfffe9e0,
isUnaryExpression=false, isAddressOfOperand=false, TypeOfCast=0x0) at
ParseExpr.cpp:403
#32 0x086b22ef in clang::Parser::ParseAssignmentExpression (this=0xbfffe9e0) at
ParseExpr.cpp:231
#33 0x086c6ed5 in clang::Parser::ParseNonTypeTemplateParameter
(this=0xbfffe9e0, Depth=0, Position=0) at ParseTemplate.cpp:590
#34 0x086c63d0 in clang::Parser::ParseTemplateParameter (this=0xbfffe9e0,
Depth=0, Position=0) at ParseTemplate.cpp:399
#35 0x086c6164 in clang::Parser::ParseTemplateParameterList (this=0xbfffe9e0,
Depth=0, TemplateParams=...) at ParseTemplate.cpp:313
#36 0x086c608a in clang::Parser::ParseTemplateParameters (this=0xbfffe9e0,
Depth=0, TemplateParams=..., LAngleLoc=..., RAngleLoc=...) at
ParseTemplate.cpp:290
#37 0x086c5765 in clang::Parser::ParseTemplateDeclarationOrSpecialization
(this=0xbfffe9e0, Context=0, DeclEnd=..., AS=clang::AS_none) at
ParseTemplate.cpp:127
#38 0x086c5538 in clang::Parser::ParseDeclarationStartingWithTemplate
(this=0xbfffe9e0, Context=0, DeclEnd=..., AS=clang::AS_none) at
ParseTemplate.cpp:32
#39 0x0869d653 in clang::Parser::ParseDeclaration (this=0xbfffe9e0, Context=0,
DeclEnd=..., Attr=...) at ParseDecl.cpp:319
#40 0x08697f18 in clang::Parser::ParseExternalDeclaration (this=0xbfffe9e0,
Attr=...) at Parser.cpp:461
#41 0x086978db in clang::Parser::ParseTopLevelDecl (this=0xbfffe9e0,
Result=...) at Parser.cpp:351
#42 0x082d741c in clang::ParseAST (PP=..., Consumer=0x979f3f0, Ctx=...,
PrintStats=false, CompleteTranslationUnit=true, CompletionConsumer=0x0) at
ParseAST.cpp:87
#43 0x080808f2 in clang::ASTFrontendAction::ExecuteAction (this=0x9782350) at
FrontendAction.cpp:224
#44 0x08080563 in clang::FrontendAction::Execute (this=0x9782350) at
FrontendAction.cpp:150
#45 0x0806cc8d in clang::CompilerInstance::ExecuteAction (this=0x9782170,
Act=...) at CompilerInstance.cpp:511
#46 0x0804ea75 in cc1_main (ArgBegin=0xbffff40c, ArgEnd=0xbffff410,
Argv0=0xbffff580 "/usr/local/bin/clang++", MainAddr=0x80564a4) at
cc1_main.cpp:285
#47 0x080572b3 in main (argc=3, argv=0xbffff404) at driver.cpp:186

-- 
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