Closed arsenm closed 1 year ago
Repro with clang 8 I encountered this problem in Clang 8.0.0. The most obvious problem was that I forgot the include file for my base class. Adding this include made the assertion go away
[24/31] CXX host_x64/obj/garnet/bin/zxdb/client/libclient.step_over_range_thread_controller.o
FAILED: host_x64/obj/garnet/bin/zxdb/client/libclient.step_over_range_thread_controller.o
/usr/local/google/home/brettw/goma/gomacc ../../buildtools/linux-x64/clang/bin/clang++ -MD -MF host_x64/obj/garnet/bin/zxdb/client/libclient.step_over_range_thread_controller.o.d -I../.. -Ihost_x64/gen -I../../garnet/public -I../../peridot/public -I../../topaz/public -Ihost_x64/gen/garnet/public -Ihost_x64/gen/peridot/public -Ihost_x64/gen/topaz/public -Ihost_x64/gen/third_party/llvm/lib/Target/AArch64 -Ihost_x64/gen/third_party/llvm/lib/IR -I../../third_party/llvm/include -I../../build/secondary/third_party/llvm/include -Ihost_x64/gen/third_party/llvm/lib/Target/X86 --sysroot=/usr/local/google/home/brettw/prj/garnet/buildtools/linux-x64/sysroot -fdebug-prefix-map=/usr/local/google/home/brettw/prj/garnet=../.. -no-canonical-prefixes -fomit-frame-pointer -g3 -Wall -Wextra -Wno-unused-parameter -fvisibility=hidden -Og -fvisibility-inlines-hidden -std=c++14 -stdlib=libc++ -fno-exceptions -fno-rtti -c ../../garnet/bin/zxdb/client/step_over_range_thread_controller.cc -o host_x64/obj/garnet/bin/zxdb/client/libclient.step_over_range_thread_controller.o
In file included from ../../garnet/bin/zxdb/client/step_over_range_thread_controller.cc:5:
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:21:46: error: unknown class name 'ThreadController'; did you mean 'UntilThreadController'?
class StepOverRangeThreadController : public ThreadController {
^~~~
UntilThreadController
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:10:7: note: 'UntilThreadController' declared here
class UntilThreadController;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:21:46: error: base class has incomplete type
class StepOverRangeThreadController : public ThreadController {
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:10:7: note: forward declaration of 'zxdb::UntilThreadController'
class UntilThreadController;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:24:33: error: unknown type name 'uint64_t'
StepOverRangeThreadController(uint64_t begin, uint64_t end);
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:24:49: error: unknown type name 'uint64_t'
StepOverRangeThreadController(uint64_t begin, uint64_t end);
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:26:36: error: only virtual member functions can be marked 'override'
~StepOverRangeThreadController() override;
^~~~~~~~
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:29:23: error: unknown type name 'Thread'
void InitWithThread(Thread* thread,
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:30:23: error: use of undeclared identifier 'std'
std::function<void(const Err&)> cb) override;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:30:48: error: unknown type name 'Err'
std::function<void(const Err&)> cb) override;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:31:3: error: unknown type name 'ContinueOp'
ContinueOp GetContinueOp() override;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:32:3: error: unknown type name 'StopOp'
StopOp OnThreadStop(
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:33:7: error: use of undeclared identifier 'debug_ipc'
debug_ipc::NotifyException::Type stop_type,
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:34:13: error: use of undeclared identifier 'std'
const std::vector<fxl::WeakPtr<Breakpoint>>& hit_breakpoints) override;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:34:25: error: use of undeclared identifier 'fxl'
const std::vector<fxl::WeakPtr<Breakpoint>>& hit_breakpoints) override;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:34:38: error: use of undeclared identifier 'Breakpoint'
const std::vector<fxl::WeakPtr<Breakpoint>>& hit_breakpoints) override;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:34:77: error: expected ')'
const std::vector<fxl::WeakPtr<Breakpoint>>& hit_breakpoints) override;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:32:22: note: to match this '('
StopOp OnThreadStop(
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:38:3: error: unknown type name 'uint64_t'
uint64_t frame_bp_ = 0;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:41:3: error: use of undeclared identifier 'std'
std::unique_ptr<StepInRangeThreadController> step_in_range_;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.h:45:3: error: use of undeclared identifier 'std'
std::unique_ptr<UntilThreadController> finish_;
^
../../garnet/bin/zxdb/client/step_over_range_thread_controller.cc:14:32: error: out-of-line definition of 'StepOverRangeThreadController' does not match any declaration in 'zxdb::StepOverRangeThreadController'
StepOverRangeThreadController::StepOverRangeThreadController(uint64_t begin,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
clang++: /b/s/w/ir/kitchen-workdir/llvm-project/clang/lib/Sema/SemaTemplate.cpp:4082: clang::ExprResult clang::Sema::BuildTemplateIdExpr(const clang::CXXScopeSpec &, clang::SourceLocation, clang::LookupResult &, bool, const clang::TemplateArgumentListInfo *): Assertion `!R.empty() && "empty lookup results when building templateid"' failed.
clang++: error: unable to execute command: Aborted
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Fuchsia clang version 8.0.0 (https://fuchsia.googlesource.com/a/third_party/clang 7e2622ef400b7a11434ef0ca3e4ff9a8c665e946) (https://fuchsia.googlesource.com/a/third_party/llvm 024925d385a9c4f1e81f175877489e3a1a7077fa) (based on LLVM 8.0.0svn)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: ../../buildtools/linux-x64/clang/bin
clang++: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang++: note: diagnostic msg:
********************
Still reproduces in a debug build on trunk: fatal error: too many errors emitted, stopping now [-ferror-limit=] clang: ../tools/clang/lib/Sema/SemaTemplate.cpp:3761: ExprResult clang::Sema::BuildTemplateIdExpr(const clang::CXXScopeSpec &, clang::SourceLocation, clang::LookupResult &, bool, const clang::TemplateArgumentListInfo *): Assertion `!R.empty() && "empty lookup results when building templateid"' failed.
Stack dump:
Can't reproduce
@llvm/issue-subscribers-clang-frontend
Extended Description
While trying to templatize the DominanceFrontier analysis, I ran into this clang crash. It reproduces in 3.4 and on trunk, and only with -std=c++11:
In file included from /Users/matt/src/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp:13: In file included from /Users/matt/src/llvm/include/llvm/Analysis/RegionInfo.h:32: /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:186:9: error: unknown type name 'DomSetType' const DomSetType &calculate(const DominatorTree &DT, ^ /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:163:5: error: member initializer 'DominanceFrontierBase' does not name a non-static data member or base class DominanceFrontierBase(ID, false) { ^().getDomTree();
^().getDomTree();
^' with '->'
DominatorTree &DT = getAnalysis().getDomTree();
^
/Users/matt/src/llvm/include/llvm/PassAnalysisSupport.h:199:21: note: member 'getAnalysis' declared here
AnalysisType &Pass::getAnalysis() const {
^
In file included from /Users/matt/src/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp:13:
In file included from /Users/matt/src/llvm/include/llvm/Analysis/RegionInfo.h:32:
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:175:5: error: use of undeclared identifier 'Roots'
Roots = DT.getRoots();
^
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:176:25: error: use of undeclared identifier 'Roots'
( builtin_expect(!(Roots.size() == 1 && "Only one entry block for forward domfronts!"), 0) ? assert_rtn(func, "/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h", 176...
^
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:177:22: error: use of undeclared identifier 'Roots'
calculate(DT, DT[Roots[0]]);
^
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:190:59: error: use of undeclared identifier 'BlockT'; did you mean 'clock'?
class DominanceFrontier : public DominanceFrontierSubBase {
^ asm("_" "clock") ;
^
In file included from /Users/matt/src/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp:13:
In file included from /Users/matt/src/llvm/include/llvm/Analysis/RegionInfo.h:32:
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:190:59: error: template argument for template type parameter must be a type
class DominanceFrontier : public DominanceFrontierSubBase {
^
^
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:204:34: error: only virtual member functions can be marked 'override'
bool runOnFunction(Function &) override {
^ {
^
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:190:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:194:3: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
DominanceFrontier() :
^
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:200:25: error: use of undeclared identifier 'Roots'
(builtin_expect(!(Roots.size() == 1 && "Should always have entry node!"), 0) ? __assert_rtn(func, "/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h", 200, "Roots.size...
^
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:201:12: error: use of undeclared identifier 'Roots'
return Roots[0];
^
/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:205:5: error: use of undeclared identifier 'Frontiers'
Frontiers.clear();
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Assertion failed: (!R.empty() && "empty lookup results when building templateid"), function BuildTemplateIdExpr, file /Users/matt/src/llvm/tools/clang/lib/Sema/SemaTemplate.cpp, line 2839.
0 clang-3.5 0x00000001104562ee llvm::sys::PrintStackTrace(sFILE) + 46
1 clang-3.5 0x00000001104565fb PrintStackTraceSignalHandler(void) + 27
2 clang-3.5 0x000000011045698c SignalHandler(int) + 412
3 libsystem_platform.dylib 0x00007fff94bbe5aa _sigtramp + 26
4 clang-3.5 0x0000000111dea4d9 clang::UnresolvedSetImpl::begin() const + 41
5 clang-3.5 0x000000011045662b raise + 27
6 clang-3.5 0x00000001104566e2 abort + 18
7 clang-3.5 0x00000001104566c1 __assert_rtn + 129
8 clang-3.5 0x000000011225f0c9 clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&, clang::SourceLocation, clang::LookupResult&, bool, clang::TemplateArgumentListInfo const) + 153
9 clang-3.5 0x0000000112005f7a clang::Sema::ActOnIdExpression(clang::Scope, clang::CXXScopeSpec&, clang::SourceLocation, clang::UnqualifiedId&, bool, bool, clang::CorrectionCandidateCallback, bool) + 3594
10 clang-3.5 0x0000000111b4fffc clang::Parser::ParseCXXIdExpression(bool) + 524
11 clang-3.5 0x0000000111b45b6d clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState) + 8285
12 clang-3.5 0x0000000111b420f3 clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState) + 83
13 clang-3.5 0x0000000111b44141 clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState) + 1585
14 clang-3.5 0x0000000111b420f3 clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState) + 83
15 clang-3.5 0x0000000111b40fb8 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 200
16 clang-3.5 0x0000000111b392a5 clang::Parser::ParseInitializer() + 69
17 clang-3.5 0x0000000111b16b14 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit) + 2116
18 clang-3.5 0x0000000111b15453 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool, clang::SourceLocation, clang::Parser::ForRangeInit) + 1491
19 clang-3.5 0x0000000111b11448 clang::Parser::ParseSimpleDeclaration(llvm::SmallVector<clang::Stmt, 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit) + 632
20 clang-3.5 0x0000000111b11176 clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt, 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 950
21 clang-3.5 0x0000000111b7eac3 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt, 32u>&, bool, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&) + 1459
22 clang-3.5 0x0000000111b7e3c5 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt, 32u>&, bool, clang::SourceLocation) + 133
23 clang-3.5 0x0000000111b8526e clang::Parser::ParseCompoundStatementBody(bool) + 1262
24 clang-3.5 0x0000000111b85de8 clang::Parser::ParseFunctionStatementBody(clang::Decl, clang::Parser::ParseScope&) + 328
25 clang-3.5 0x0000000111b083ff clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 1663
26 clang-3.5 0x0000000111b07d74 clang::Parser::LexedMethod::ParseLexedMethodDefs() + 36
27 clang-3.5 0x0000000111b074f1 clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 321
28 clang-3.5 0x0000000111b31597 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl) + 4615
29 clang-3.5 0x0000000111b2ff2c clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) + 9404
30 clang-3.5 0x0000000111b13de5 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList) + 10565
31 clang-3.5 0x0000000111b9fd06 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) + 102
32 clang-3.5 0x0000000111b9f891 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec, clang::AccessSpecifier) + 161
33 clang-3.5 0x0000000111b9efec clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec) + 3580
34 clang-3.5 0x0000000111b2969e clang::Parser::ParseInnerNamespace(std::1::vector<clang::SourceLocation, std::1::allocator >&, std::1::vector<clang::IdentifierInfo*, std::1::allocator<clang::IdentifierInfo> >&, std::1::vector<clang::SourceLocation, std::1::allocator >&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 318
35 clang-3.5 0x0000000111b29117 clang::Parser::ParseNamespace(unsigned int, clang::SourceLocation&, clang::SourceLocation) + 6679
36 clang-3.5 0x0000000111b110c7 clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt , 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 775
37 clang-3.5 0x0000000111b9eb72 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec) + 2434
38 clang-3.5 0x0000000111b9e17f clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&) + 703
39 clang-3.5 0x0000000111b03a0d clang::ParseAST(clang::Sema&, bool, bool) + 989
40 clang-3.5 0x000000011084c14a clang::ASTFrontendAction::ExecuteAction() + 522
41 clang-3.5 0x00000001111887fa clang::CodeGenAction::ExecuteAction() + 3322
42 clang-3.5 0x000000011084bbb8 clang::FrontendAction::Execute() + 120
43 clang-3.5 0x00000001107e7f9e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 990
44 clang-3.5 0x00000001108a7610 clang::ExecuteCompilerInvocation(clang::CompilerInstance ) + 3200
45 clang-3.5 0x000000010f0696f0 cc1_main(char const, char const, char const, void) + 2368
46 clang-3.5 0x000000010f05a62a main + 858
47 libdyld.dylib 0x00007fff939d25fd start + 1
Stack dump:
~~~~~~~ /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:168:25: error: use of undeclared identifier 'Roots' (builtin_expect(!(Roots.size() == 1 && "Should always have entry node!"), 0) ? __assert_rtn(func, "/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h", 168, "Roots.size... ^ /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:169:12: error: use of undeclared identifier 'Roots' return Roots[0]; ^ /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:173:5: error: use of undeclared identifier 'Frontiers' Frontiers.clear(); ^ /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:174:25: error: no template named 'getAnalysis'; did you mean 'DominatorTreeWrapperPass::getAnalysis'? DominatorTree &DT = getAnalysis~~DominatorTreeWrapperPass::getAnalysis /Users/matt/src/llvm/include/llvm/PassAnalysisSupport.h:199:21: note: 'DominatorTreeWrapperPass::getAnalysis' declared here AnalysisType &Pass::getAnalysis() const { ^ In file included from /Users/matt/src/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp:13: In file included from /Users/matt/src/llvm/include/llvm/Analysis/RegionInfo.h:32: /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:174:25: error: no template named 'getAnalysis'; did you mean 'DominatorTreeWrapperPass::getAnalysis'? DominatorTree &DT = getAnalysis~~DominatorTreeWrapperPass::getAnalysis /Users/matt/src/llvm/include/llvm/PassAnalysisSupport.h:199:21: note: 'DominatorTreeWrapperPass::getAnalysis' declared here AnalysisType &Pass::getAnalysis() const { ^ In file included from /Users/matt/src/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp:13: In file included from /Users/matt/src/llvm/include/llvm/Analysis/RegionInfo.h:32: /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:174:25: error: cannot refer to member 'getAnalysis' in 'DominanceFrontierSubBase~clock /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/time.h:109:9: note: 'clock' declared here clock_t clock(void)~/Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:157:16: note: template parameter is declared here template~~~~ /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:213:50: error: only virtual member functions can be marked 'override' void getAnalysisUsage(AnalysisUsage &AU) const override { ^~~~~ /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:195:5: error: no matching constructor for initialization of 'llvm::DominanceFrontier' DominanceFrontier(ID, false) { ^~~~~~ /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:190:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided class DominanceFrontier : public DominanceFrontierSubBasePLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-3.5: note: diagnostic msg: /var/folders/bl/gvmy_j0521v7tdtlsmxb805w0000gn/T/clang_crash_preprocessed-9a53f4.cpp clang-3.5: note: diagnostic msg: /var/folders/bl/gvmy_j0521v7tdtlsmxb805w0000gn/T/clang_crash_preprocessed-9a53f4.sh clang-3.5: note: diagnostic msg: