[LLVMbugs] [Bug 8774] New: crash on checking default argument
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Dec 10 19:08:04 PST 2010
http://llvm.org/bugs/show_bug.cgi?id=8774
Summary: crash on checking default argument
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: nlewycky at google.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
This testcase crashes:
template < typename Value > class FooKey { };
template < typename T > struct Traits { };
template < typename K > K BlahGetKey (const FooKey <K> &key,
typename Traits <K>::
default_value_type const &defval =
Traits < K >::default_value ()) {
return defval;
}
template <> struct Traits <const char *> {
typedef const char *default_value_type;
static const char *default_value();
};
class BlahFooTest {
template < typename T > void BasicTest () {
FooKey < T > nokey;
T values;
BlahGetKey (nokey, values);
}
void f() { BasicTest<const char *>(); }
};
"clang -fsyntax-only" produces this segfault:
0x0000000001094b28 in clang::Expr::isTypeDependent (this=0x0)
at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/Serialization/../../include/clang/AST/Expr.h:110
110 bool isTypeDependent() const { return ExprBits.TypeDependent; }
(gdb) bt
#0 0x0000000001094b28 in clang::Expr::isTypeDependent (this=0x0)
at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/Serialization/../../include/clang/AST/Expr.h:110
#1 0x00000000012772fb in EvalAddr (E=0x0, refVars=...)
at SemaChecking.cpp:1852
#2 0x00000000012774e9 in EvalAddr (E=0x32fa970, refVars=...)
at SemaChecking.cpp:1879
#3 0x0000000001277869 in EvalAddr (E=0x32fa9a0, refVars=...)
at SemaChecking.cpp:1954
#4 0x0000000001276ecb in clang::Sema::CheckReturnStackAddr (this=0x32d4360,
RetValExp=0x32fa9a0, lhsType=..., ReturnLoc=...) at SemaChecking.cpp:1775
#5 0x00000000013c5b3c in clang::Sema::ActOnReturnStmt (this=0x32d4360,
ReturnLoc=..., RetValExp=0x32fa9a0) at SemaStmt.cpp:1296
#6 0x00000000014494a6 in
clang::TreeTransform<<unnamed>::TemplateInstantiator>::RebuildReturnStmt(clang::SourceLocation,
clang::Expr *) (this=0x7fffffffbe00,
ReturnLoc=..., Result=0x32fa970) at TreeTransform.h:872
#7 0x000000000143dd94 in
clang::TreeTransform<<unnamed>::TemplateInstantiator>::TransformReturnStmt(clang::ReturnStmt
*) (this=0x7fffffffbe00, S=0x32f5840)
at TreeTransform.h:3933
#8 0x00000000014356f2 in
clang::TreeTransform<<unnamed>::TemplateInstantiator>::TransformStmt(clang::Stmt
*) (this=0x7fffffffbe00, S=0x32f5840)
at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/Sema/../../include/clang/AST/StmtNodes.inc:613
#9 0x0000000001448e0e in
clang::TreeTransform<<unnamed>::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt
*, bool) (this=0x7fffffffbe00,
S=0x32f5868, IsStmtExpr=false) at TreeTransform.h:3559
#10 0x000000000143c2c6 in
clang::TreeTransform<<unnamed>::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt
*) (this=0x7fffffffbe00,
S=0x32f5868) at TreeTransform.h:3547
#11 0x0000000001435442 in
clang::TreeTransform<<unnamed>::TemplateInstantiator>::TransformStmt(clang::Stmt
*) (this=0x7fffffffbe00, S=0x32f5868)
at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/Sema/../../include/clang/AST/StmtNodes.inc:39
#12 0x0000000001433595 in clang::Sema::SubstStmt (this=0x32d4360, S=0x32f5868,
TemplateArgs=...) at SemaTemplateInstantiate.cpp:1638
#13 0x0000000001457635 in clang::Sema::InstantiateFunctionDefinition (
this=0x32d4360, PointOfInstantiation=..., Function=0x32fa710,
Recursive=true, DefinitionRequired=false)
at SemaTemplateInstantiateDecl.cpp:2159
#14 0x0000000001459421 in clang::Sema::PerformPendingInstantiations (
this=0x32d4360, LocalOnly=false) at SemaTemplateInstantiateDecl.cpp:2790
#15 0x0000000001457773 in clang::Sema::InstantiateFunctionDefinition (
this=0x32d4360, PointOfInstantiation=..., Function=0x32f80b0,
Recursive=true, DefinitionRequired=false)
at SemaTemplateInstantiateDecl.cpp:2185
#16 0x0000000001459421 in clang::Sema::PerformPendingInstantiations (
this=0x32d4360, LocalOnly=false) at SemaTemplateInstantiateDecl.cpp:2790
#17 0x0000000001255196 in clang::Sema::ActOnEndOfTranslationUnit (
this=0x32d4360) at Sema.cpp:303
#18 0x0000000001218d40 in clang::Parser::ParseTopLevelDecl (
this=0x7fffffffcad0, Result=...) at Parser.cpp:401
#19 0x0000000001202a14 in clang::ParseAST (S=..., PrintStats=false)
at ParseAST.cpp:83
#20 0x0000000000f6a695 in clang::ASTFrontendAction::ExecuteAction (
this=0x32a7d60) at FrontendAction.cpp:329
#21 0x0000000000f6a2e6 in clang::FrontendAction::Execute (this=0x32a7d60)
at FrontendAction.cpp:249
#22 0x0000000000f5315b in clang::CompilerInstance::ExecuteAction (
this=0x32a7920, Act=...) at CompilerInstance.cpp:550
#23 0x0000000000f02889 in clang::ExecuteCompilerInvocation (Clang=0x32a7920)
at ExecuteCompilerInvocation.cpp:149
#24 0x0000000000ef5859 in cc1_main (ArgBegin=0x7fffffffd4c0,
ArgEnd=0x7fffffffd4d8,
Argv0=0x329d918
"/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang++",
MainAddr=0xefd694) at cc1_main.cpp:161
#25 0x0000000000efe98a in main (argc_=5, argv_=0x7fffffffe3e8)
at driver.cpp:270
(gdb) up 3
#3 0x0000000001277869 in EvalAddr (E=0x32fa9a0, refVars=...)
at SemaChecking.cpp:1954
1954 return EvalAddr(SubExpr, refVars);
(gdb) call SubExpr->dump()
(DeclRefExpr 0x32fa970 'typename Traits<const char *>::default_value_type
const':'const char *const' lvalue ParmVar='defval' 0x32fa610)
(gdb) down
#2 0x00000000012774e9 in EvalAddr (E=0x32fa970, refVars=...)
at SemaChecking.cpp:1879
1879 return EvalAddr(V->getInit(), refVars);
(gdb) call V->dump()
typename Traits<const char *>::default_value_type const &defval
(gdb) p V->getInit()
$1 = (const clang::Expr *) 0x0
--
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