LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 11558 - Crash in ActOnExplicitInstantiation(): "point of instantiation must be valid!"
Summary: Crash in ActOnExplicitInstantiation(): "point of instantiation must be valid!"
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: C++ (show other bugs)
Version: unspecified
Hardware: PC All
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-13 14:58 PST by Nico Weber
Modified: 2011-12-23 17:56 PST (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Weber 2011-12-13 14:58:21 PST
tests-MacBook-Pro-2:delta test$ cat repro.ii
namespace std {

template<typename _CharT>
class basic_string;

typedef basic_string<char> string;

template <typename STRING_TYPE> class BasicStringPiece;

template <> class BasicStringPiece<std::string> {
};

extern template class BasicStringPiece<std::string>;
template class BasicStringPiece<std::string>;

}  // namespace std
tests-MacBook-Pro-2:delta test$ gcc -x c++ -c repro.ii
tests-MacBook-Pro-2:delta test$ ~/src/chrome-git/src/third_party/llvm-build/Release+Asserts/bin/clang -x c++ -c repro.ii
Assertion failed: (Loc.isValid() && "point of instantiation must be valid!"), function setPointOfInstantiation, file /Volumes/MacintoshHD2/src/chrome-git/src/third_party/llvm/tools/clang/lib/Sema/../../include/clang/AST/DeclTemplate.h, line 1416.
0  clang             0x00000001014c9ac2 _ZL15PrintStackTracePv + 34
1  clang             0x00000001014c9ff9 _ZL13SignalHandleri + 713
2  libsystem_c.dylib 0x00007fff8b0ffcfa _sigtramp + 26
3  clang             0x00000001002eb2ea clang::Parser::ParseTemplateArgument() + 138
4  clang             0x00000001000441e6 abort + 22
5  clang             0x0000000100044238 __assert_rtn + 56
6  clang             0x0000000100503cf5 clang::Sema::ActOnExplicitInstantiation(clang::Scope*, clang::SourceLocation, clang::SourceLocation, unsigned int, clang::SourceLocation, clang::CXXScopeSpec const&, clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation, clang::SourceLocation, clang::ASTTemplateArgsPtr, clang::SourceLocation, clang::AttributeList*) + 2119
7  clang             0x00000001002c0ee8 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, bool) + 2710
8  clang             0x00000001002b3e5e clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext) + 6218
9  clang             0x00000001002ed4b5 clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 717
10 clang             0x00000001002ea15d clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 429
11 clang             0x00000001002b6fc3 clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 381
12 clang             0x00000001002f723e clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::Parser::ParsingDeclSpec*) + 1776
13 clang             0x00000001002c287a clang::Parser::ParseInnerNamespace(std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> >&, std::vector<clang::IdentifierInfo*, std::allocator<clang::IdentifierInfo*> >&, std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> >&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::Parser::BalancedDelimiterTracker&) + 256
14 clang             0x00000001002b861b clang::Parser::ParseNamespace(unsigned int, clang::SourceLocation&, clang::SourceLocation) + 3323
15 clang             0x00000001002b706b clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 549
16 clang             0x00000001002f723e clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::Parser::ParsingDeclSpec*) + 1776
17 clang             0x00000001002f7d6e clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 262
18 clang             0x00000001002a3175 clang::ParseAST(clang::Sema&, bool) + 325
19 clang             0x000000010026f2cc clang::CodeGenAction::ExecuteAction() + 924
20 clang             0x0000000100065a96 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 962
21 clang             0x000000010004da31 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2161
22 clang             0x0000000100047acb cc1_main(char const**, char const**, char const*, void*) + 2923
23 clang             0x000000010004aab0 main + 640
24 clang             0x0000000100046f4c start + 52
25 clang             0x000000000000002f start + 18446744069414293783
Stack dump:
0.	Program arguments: /Users/test/src/chrome-git/src/third_party/llvm-build/Release+Asserts/bin/clang -cc1 -triple x86_64-apple-macosx10.7.2 -emit-obj -mrelax-all -disable-free -main-file-name repro.ii -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 97.17 -coverage-file repro.o -resource-dir /Users/test/src/chrome-git/src/third_party/llvm-build/Release+Asserts/bin/../lib/clang/3.1 -fmodule-cache-path /var/folders/5j/6xp_dl050mv_b_0_56s5mjx80000gn/T/clang-module-cache -fdeprecated-macro -fdebug-compilation-dir /Users/test/src/delta -ferror-limit 19 -fmessage-length 267 -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 repro.o -x c++ repro.ii 
1.	repro.ii:14:45: current parser token ';'
2.	repro.ii:1:1: parsing namespace 'std'
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/5j/6xp_dl050mv_b_0_56s5mjx80000gn/T/repro-VirH75.ii
clang: note: diagnostic msg: /var/folders/5j/6xp_dl050mv_b_0_56s5mjx80000gn/T/repro-VirH75.sh
Comment 1 Nico Weber 2011-12-16 11:40:39 PST
The assert originates from

  else if (TSK == TSK_ExplicitInstantiationDefinition) {
    MarkVTableUsed(TemplateNameLoc, Specialization, true);
    Specialization->setPointOfInstantiation(Def->getPointOfInstantiation());
  }

in SemaTemplate.cpp. That call was added in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100607/031205.html
Comment 3 Nico Weber 2011-12-23 17:56:09 PST
r147225