llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.11k stars 12.01k forks source link

Assertion failed: (!R.empty() && "empty lookup results when building templateid") #20558

Closed arsenm closed 1 year ago

arsenm commented 10 years ago
Bugzilla Link 20184
Version trunk
OS All
Attachments Preprocessed source + script
CC @DougGregor

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) { ^~~~~~~~ /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().getDomTree(); ^~~ 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().getDomTree(); ^~~ 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' 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 { ^~ 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) 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:157:16: note: template parameter is declared here template ^ /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: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 DominanceFrontierSubBase { ^ /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:

  1. Program arguments: /usr/local/bin/clang-3.5 -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -main-file-name clang_crash_preprocessed.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -resource-dir /usr/local/bin/../lib/clang/3.5.0 -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 198 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/bl/gvmy_j0521v7tdtlsmxb805w0000gn/T/clang_crash_preprocessed-afcc35.o -x c++ /Users/matt/clang_crash_preprocessed.cpp
  2. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:206:62: current parser token '('
  3. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:25:1: parsing namespace 'llvm'
  4. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:190:1: parsing struct/union/class body 'DominanceFrontier'
  5. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:204:43: parsing function body 'runOnFunction'
  6. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:204:43: in compound statement ('{}') clang-3.5: error: unable to execute command: Illegal instruction: 4 clang-3.5: error: clang frontend command failed due to signal (use -v to see invocation) clang version 3.5.0 Target: x86_64-apple-darwin13.2.0 Thread model: posix clang-3.5: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang-3.5: note: diagnostic msg:

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

llvmbot commented 6 years 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: 
********************
arsenm commented 7 years ago

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.

​0 0x00000000030f59b9 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/marsenau/src/llvm/build_debug/../lib/Support/Unix/Signals.inc:398:11

​1 0x00000000030f5b69 PrintStackTraceSignalHandler(void*) /home/marsenau/src/llvm/build_debug/../lib/Support/Unix/Signals.inc:462:1

​2 0x00000000030f41d3 llvm::sys::RunSignalHandlers() /home/marsenau/src/llvm/build_debug/../lib/Support/Signals.cpp:50:5

​3 0x00000000030f5ec4 SignalHandler(int) /home/marsenau/src/llvm/build_debug/../lib/Support/Unix/Signals.inc:252:1

​4 0x00007f0e85d44390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)

​5 0x00007f0e848af428 gsignal /build/glibc-t3gR2i/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0

​6 0x00007f0e848b102a abort /build/glibc-t3gR2i/glibc-2.23/stdlib/abort.c:91:0

​7 0x00007f0e848a7bd7 __assert_fail_base /build/glibc-t3gR2i/glibc-2.23/assert/assert.c:92:0

​8 0x00007f0e848a7c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)

​9 0x0000000005c33b9b clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&, clang::SourceLocation, clang::LookupResult&, bool, clang::TemplateArgumentListInfo const*) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Sema/SemaTemplate.cpp:3762:3

​10 0x00000000058015fb clang::Sema::ActOnIdExpression(clang::Scope, clang::CXXScopeSpec&, clang::SourceLocation, clang::UnqualifiedId&, bool, bool, std::unique_ptr<clang::CorrectionCandidateCallback, std::default_delete >, bool, clang::Token) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Sema/SemaExpr.cpp:2361:12

​11 0x00000000050316ca clang::Parser::tryParseCXXIdExpression(clang::CXXScopeSpec&, bool, clang::Token&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseExprCXX.cpp:564:10

​12 0x00000000050329f9 clang::Parser::ParseCXXIdExpression(bool) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseExprCXX.cpp:622:7

​13 0x0000000005020a56 clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseExpr.cpp:1321:11

​14 0x00000000050193c5 clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState, bool) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseExpr.cpp:521:20

​15 0x000000000501eb5e clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseExpr.cpp:923:18

​16 0x00000000050193c5 clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState, bool) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseExpr.cpp:521:20

​17 0x0000000005017d53 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseExpr.cpp:168:20

​18 0x0000000004fe72b0 clang::Parser::ParseInitializer() /home/marsenau/src/llvm/build_debug/../tools/clang/include/clang/Parse/Parser.h:1679:14

​19 0x0000000004fd759b clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDecl.cpp:2216:23

​20 0x0000000004fd5956 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, clang::SourceLocation, clang::Parser::ForRangeInit) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDecl.cpp:2006:21

​21 0x0000000004fd043b clang::Parser::ParseSimpleDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDecl.cpp:1738:10

​22 0x0000000004fd0106 clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDecl.cpp:1679:12

​23 0x000000000507ae08 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseStmt.cpp:214:29

​24 0x000000000507a5a0 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseStmt.cpp:110:20

​25 0x0000000005081d14 clang::Parser::ParseCompoundStatementBody(bool) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseStmt.cpp:1001:11

​26 0x00000000050828e2 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseStmt.cpp:1967:21

​27 0x0000000004fbf9fe clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseCXXInlineMethods.cpp:562:7

​28 0x0000000004fbf494 clang::Parser::LexedMethod::ParseLexedMethodDefs() /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseCXXInlineMethods.cpp:264:1

​29 0x0000000004fbe2ee clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseCXXInlineMethods.cpp:487:63

​30 0x0000000004ffad23 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDeclCXX.cpp:3287:21

​31 0x0000000004ff950a clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDeclCXX.cpp:1910:7

​32 0x0000000004fd41b1 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDecl.cpp:3588:7

​33 0x0000000004fadbcd clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/Parser.cpp:916:7

​34 0x0000000004fad7e0 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/Parser.cpp:993:12

​35 0x0000000004fad0bd clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/Parser.cpp:843:12

​36 0x0000000004ff1b3c clang::Parser::ParseInnerNamespace(std::vector<clang::SourceLocation, std::allocator >&, std::vector<clang::IdentifierInfo, std::allocator<clang::IdentifierInfo> >&, std::vector<clang::SourceLocation, std::allocator >&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDeclCXX.cpp:220:7

​37 0x0000000004ff1440 clang::Parser::ParseNamespace(unsigned int, clang::SourceLocation&, clang::SourceLocation) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDeclCXX.cpp:195:3

​38 0x0000000004fd0065 clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseDecl.cpp:1669:12

​39 0x0000000004facc18 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/Parser.cpp:776:14

​40 0x0000000004fab8ce clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/Parser.cpp:611:12

​41 0x0000000004fa6782 clang::ParseAST(clang::Sema&, bool, bool) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Parse/ParseAST.cpp:147:14

​42 0x0000000003afb62c clang::ASTFrontendAction::ExecuteAction() /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Frontend/FrontendAction.cpp:997:1

​43 0x000000000406402b clang::CodeGenAction::ExecuteAction() /home/marsenau/src/llvm/build_debug/../tools/clang/lib/CodeGen/CodeGenAction.cpp:990:1

​44 0x0000000003afb0a0 clang::FrontendAction::Execute() /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Frontend/FrontendAction.cpp:898:7

​45 0x0000000003a8c947 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/Frontend/CompilerInstance.cpp:977:7

​46 0x0000000003c71a5a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/marsenau/src/llvm/build_debug/../tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:250:8

​47 0x0000000000ebf344 cc1_main(llvm::ArrayRef<char const>, char const, void*) /home/marsenau/src/llvm/build_debug/../tools/clang/tools/driver/cc1_main.cpp:221:11

​48 0x0000000000eb24d9 ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) /home/marsenau/src/llvm/build_debug/../tools/clang/tools/driver/driver.cpp:306:5

​49 0x0000000000eb1128 main /home/marsenau/src/llvm/build_debug/../tools/clang/tools/driver/driver.cpp:387:5

​50 0x00007f0e8489a830 __libc_start_main /build/glibc-t3gR2i/glibc-2.23/csu/../csu/libc-start.c:325:0

​51 0x0000000000eb0149 _start (/home/marsenau/src/llvm/build_debug/bin/clang+0xeb0149)

Stack dump:

  1. Program arguments: /home/marsenau/src/llvm/build_debug/bin/clang -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -main-file-name clang_crash_preprocessed.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -stdlib=libc++ -std=c++11 -fdeprecated-macro -ferror-limit 19 -fmessage-length 198 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -x c++ clang_crash_preprocessed-9a53f4.cpp
  2. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:206:62: current parser token '('
  3. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:25:1: parsing namespace 'llvm'
  4. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:190:1: parsing struct/union/class body 'llvm::DominanceFrontier'
  5. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:204:43: parsing function body 'llvm::DominanceFrontier::runOnFunction'
  6. /Users/matt/src/llvm/include/llvm/Analysis/DominanceFrontier.h:204:43: in compound statement ('{}') Aborted (core dumped)
arsenm commented 1 year ago

Can't reproduce

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-frontend