[PATCH] D99696: [clang] NRVO: Improvements and handling of more cases.

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 10 20:41:41 PDT 2021


aeubanks added a comment.

Crashes on a stage 2 build on Windows:

  ../rel/bin/clang-cl /nologo /showIncludes /Foobj/llvm/lib/MC/MCParser/MCParser.MasmParser.obj /c ../../llvm/lib/MC/MCParser/MasmParser.cpp -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_UNICODE -DUNICODE -I../../llvm/include -Igen/llvm/include /Zi /FS -gline-tables-only -gcodeview-ghash /O2 /Gw /Zc:inline /EHs-c- /W4 -Wno-unused-parameter -Wdelete-non-virtual-dtor -Wstring-conversion -no-canonical-prefixes -Werror=date-time -fmsc-version=1916 /Brepro /winsysroot../../../sysroot -Wcovered-switch-default /GR-
  Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file ../../llvm/include/llvm/Support/Casting.h, line 262
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  0.      Program arguments: ../rel/bin/clang-cl /nologo /showIncludes /Foobj/llvm/lib/MC/MCParser/MCParser.MasmParser.obj /c ../../llvm/lib/MC/MCParser/MasmParser.cpp -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_UNICODE -DUNICODE -I../../llvm/include -Igen/llvm/include /Zi /FS -gline-tables-only -gcodeview-ghash /O2 /Gw /Zc:inline /EHs-c- /W4 -Wno-unused-parameter -Wdelete-non-virtual-dtor -Wstring-conversion -no-canonical-prefixes -Werror=date-time -fmsc-version=1916 /Brepro /winsysroot../../../sysroot -Wcovered-switch-default /GR-
  1.      <eof> parser at end of file
  2.      ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\ostream:320:36: instantiating function definition 'std::basic_ostream<char>::operator<<'
  3.      ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\xlocale:503:26: instantiating function definition 'std::use_facet<std::num_put<char>>'
  4.      ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\xlocnum:1417:35: instantiating function definition 'std::num_put<char>::_Getcat'
  5.      ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\xlocnum:1446:21: instantiating function definition 'std::num_put<char>::num_put'
  6.      ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\xlocnum:1504:36: instantiating function definition 'std::num_put<char>::do_put'
  7.      ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\xlocale:503:26: instantiating function definition 'std::use_facet<std::numpunct<char>>'
  8.      ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\xlocnum:163:16: instantiating function definition 'std::numpunct<char>::_Getcat'
  9.      ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\xlocnum:157:2: instantiating function definition 'std::numpunct<char>::numpunct'
  10.     ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\xlocnum:199:7: instantiating function definition 'std::numpunct<char>::_Init'
  11.     ../../../sysroot\VC\Tools\MSVC\14.16.27023\include\xlocale:662:19: instantiating function definition 'std::_Maklocstr<char>'
   #0 0x00007ff7a6b48596 HandleAbort /b/f/w/llvm-project/build/rel/../../llvm/lib/Support/Windows/Signals.inc:408:0
   #1 0x00007ff7a9cee690 raise C:\src\llvm-project\build\rel\minkernel\crts\ucrt\src\appcrt\misc\signal.cpp:547:0
   #2 0x00007ff7a9ce3fd0 abort C:\src\llvm-project\build\rel\minkernel\crts\ucrt\src\appcrt\startup\abort.cpp:71:0
   #3 0x00007ff7a9ce4672 common_assert_to_stderr<wchar_t> C:\src\llvm-project\build\rel\minkernel\crts\ucrt\src\appcrt\startup\assert.cpp:186:0
   #4 0x00007ff7a9ce451a _wassert C:\src\llvm-project\build\rel\minkernel\crts\ucrt\src\appcrt\startup\assert.cpp:443:0
   #5 0x00007ff7a8899933 llvm::PointerUnion<const clang::Type *,const clang::ExtQuals *>::isNull /b/f/w/llvm-project/build/rel/../../llvm/include/llvm/ADT/PointerUnion.h:172:0
   #6 0x00007ff7a8899933 clang::QualType::isNull /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Type.h:734:0
   #7 0x00007ff7a8899933 clang::QualType::getCommonPtr /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Type.h:684:0
   #8 0x00007ff7a8899933 clang::QualType::getTypePtr /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Type.h:6428:0
   #9 0x00007ff7a8899933 llvm::simplify_type<clang::QualType>::getSimplifiedValue /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Type.h:1318:0
  #10 0x00007ff7a8899933 llvm::simplify_type<const clang::QualType>::getSimplifiedValue /b/f/w/llvm-project/build/rel/../../llvm/include/llvm/Support/Casting.h:48:0
  #11 0x00007ff7a8899933 llvm::isa_impl_wrap<clang::FunctionType,const clang::QualType,const clang::Type *>::doit /b/f/w/llvm-project/build/rel/../../llvm/include/llvm/Support/Casting.h:121:0
  #12 0x00007ff7a8899933 llvm::isa /b/f/w/llvm-project/build/rel/../../llvm/include/llvm/Support/Casting.h:142:0
  #13 0x00007ff7a8899933 llvm::cast /b/f/w/llvm-project/build/rel/../../llvm/include/llvm/Support/Casting.h:263:0
  #14 0x00007ff7a8899933 clang::TemplateDeclInstantiator::VisitVarDecl(class clang::VarDecl *, bool, class llvm::ArrayRef<class clang::BindingDecl *> *) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1110:0
  #15 0x00007ff7a88b10f8 clang::Sema::SubstDecl::<lambda_0>::operator() /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:3837:0
  #16 0x00007ff7a88b10f8 llvm::function_ref<void ()>::callback_fn<`lambda at ../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:3836:49'> /b/f/w/llvm-project/build/rel/../../llvm/include/llvm/ADT/STLExtras.h:177:0
  #17 0x00007ff7a72917fd clang::Sema::runWithSufficientStackSpace(class clang::SourceLocation, class llvm::function_ref<(void)>) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/Sema.cpp:463:0
  #18 0x00007ff7a88a9dce clang::Sema::SubstDecl(class clang::Decl *, class clang::DeclContext *, class clang::MultiLevelTemplateArgumentList const &) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:3839:0
  #19 0x00007ff7a8a11c2d `anonymous namespace'::TemplateInstantiator::TransformDefinition /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiate.cpp:1253:0
  #20 0x00007ff7a8a11c2d clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformDeclStmt /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/TreeTransform.h:7603:0
  #21 0x00007ff7a89e3a61 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt /b/f/w/llvm-project/build/rel/gen/clang/include/clang/AST/StmtNodes.inc:97:0
  #22 0x00007ff7a8a05ab8 clang::ActionResult<clang::Stmt *,1>::isInvalid /b/f/w/llvm-project/build/rel/../../clang/include/clang/Sema/Ownership.h:207:0
  #23 0x00007ff7a8a05ab8 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/TreeTransform.h:7209:0
  #24 0x00007ff7a8a11450 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/TreeTransform.h:7192:0
  #25 0x00007ff7a89e39a0 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt /b/f/w/llvm-project/build/rel/gen/clang/include/clang/AST/StmtNodes.inc:73:0
  #26 0x00007ff7a89e36a4 llvm::DenseMap<clang::Decl *,clang::Decl *,llvm::DenseMapInfo<clang::Decl *>,llvm::detail::DenseMapPair<clang::Decl *,clang::Decl *> >::~DenseMap /b/f/w/llvm-project/build/rel/../../llvm/include/llvm/ADT/DenseMap.h:755:0
  #27 0x00007ff7a89e36a4 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::~TreeTransform /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/TreeTransform.h:101:0
  #28 0x00007ff7a89e36a4 clang::Sema::SubstStmt(class clang::Stmt *, class clang::MultiLevelTemplateArgumentList const &) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiate.cpp:3463:0
  #29 0x00007ff7a88ac61a clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4961:0
  #30 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #31 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #32 0x00007ff7a88ac6fa clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4986:0
  #33 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #34 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #35 0x00007ff7a88ac6fa clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4986:0
  #36 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #37 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #38 0x00007ff7a88ac6fa clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4986:0
  #39 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #40 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #41 0x00007ff7a88ac6fa clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4986:0
  #42 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #43 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #44 0x00007ff7a88ac6fa clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4986:0
  #45 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #46 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #47 0x00007ff7a88ac6fa clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4986:0
  #48 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #49 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #50 0x00007ff7a88ac6fa clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4986:0
  #51 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #52 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #53 0x00007ff7a88ac6fa clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4986:0
  #54 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #55 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #56 0x00007ff7a88ac6fa clang::Sema::InstantiateFunctionDefinition(class clang::SourceLocation, class clang::FunctionDecl *, bool, bool, bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4986:0
  #57 0x00007ff7a88af1ac clang::FunctionDecl::isDefined /b/f/w/llvm-project/build/rel/../../clang/include/clang/AST/Decl.h:2084:0
  #58 0x00007ff7a88af1ac clang::Sema::PerformPendingInstantiations(bool) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6207:0
  #59 0x00007ff7a7293711 llvm::TimeTraceScope::~TimeTraceScope /b/f/w/llvm-project/build/rel/../../llvm/include/llvm/Support/TimeProfiler.h:86:0
  #60 0x00007ff7a7293711 clang::Sema::ActOnEndOfTranslationUnitFragment(enum clang::Sema::TUFragmentKind) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/Sema.cpp:1001:0
  #61 0x00007ff7a72943ac clang::Sema::ActOnEndOfTranslationUnit(void) /b/f/w/llvm-project/build/rel/../../clang/lib/Sema/Sema.cpp:1042:0
  #62 0x00007ff7a98dc220 clang::Parser::ParseTopLevelDecl(class clang::OpaquePtr<class clang::DeclGroupRef> &, bool) C:\src\llvm-project\clang\lib\Parse\Parser.cpp:693:0
  #63 0x00007ff7a8bfe1ae clang::ParseAST(class clang::Sema &, bool, bool) C:\src\llvm-project\clang\lib\Parse\ParseAST.cpp:157:0
  #64 0x00007ff7a7378a64 clang::FrontendAction::Execute(void) C:\src\llvm-project\clang\lib\Frontend\FrontendAction.cpp:955:0
  #65 0x00007ff7a6830593 llvm::Error::getPtr C:\src\llvm-project\llvm\include\llvm\Support\Error.h:273:0
  #66 0x00007ff7a6830593 llvm::Error::operator bool C:\src\llvm-project\llvm\include\llvm\Support\Error.h:236:0
  #67 0x00007ff7a6830593 clang::CompilerInstance::ExecuteAction(class clang::FrontendAction &) C:\src\llvm-project\clang\lib\Frontend\CompilerInstance.cpp:977:0
  #68 0x00007ff7a68c5ba3 clang::ExecuteCompilerInvocation(class clang::CompilerInstance *) C:\src\llvm-project\clang\lib\FrontendTool\ExecuteCompilerInvocation.cpp:278:0
  #69 0x00007ff7a67b1a81 cc1_main(class llvm::ArrayRef<char const *>, char const *, void *) /b/f/w/llvm-project/build/rel/../../clang/tools/driver/cc1_main.cpp:246:0
  #70 0x00007ff7a67c4df4 ExecuteCC1Tool /b/f/w/llvm-project/build/rel/../../clang/tools/driver/driver.cpp:338:0
  #71 0x00007ff7a71584e6 clang::driver::CC1Command::Execute::<lambda_1>::operator() C:\src\llvm-project\clang\lib\Driver\Job.cpp:404:0
  #72 0x00007ff7a71584e6 llvm::function_ref<void ()>::callback_fn<`lambda at ../../clang/lib/Driver/Job.cpp:404:22'> C:\src\llvm-project\llvm\include\llvm\ADT\STLExtras.h:177:0
  #73 0x00007ff7a6b08cf2 llvm::CrashRecoveryContext::RunSafely(class llvm::function_ref<(void)>) /b/f/w/llvm-project/build/rel/../../llvm/lib/Support/CrashRecoveryContext.cpp:233:0
  #74 0x00007ff7a7158171 clang::driver::CC1Command::Execute(class llvm::ArrayRef<class llvm::Optional<class llvm::StringRef>>, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> *, bool *) const C:\src\llvm-project\clang\lib\Driver\Job.cpp:404:0
  #75 0x00007ff7a67f2345 clang::driver::Compilation::ExecuteCommand(class clang::driver::Command const &, class clang::driver::Command const *&) const /b/f/w/llvm-project/build/rel/../../clang/lib/Driver/Compilation.cpp:196:0
  #76 0x00007ff7a67f282b clang::driver::Compilation::ExecuteJobs(class clang::driver::JobList const &, class llvm::SmallVectorImpl<struct std::pair<int, class clang::driver::Command const *>> &) const /b/f/w/llvm-project/build/rel/../../clang/lib/Driver/Compilation.cpp:249:0
  #77 0x00007ff7a6809107 llvm::SmallVectorBase<unsigned int>::empty C:\src\llvm-project\llvm\include\llvm\ADT\SmallVector.h:72:0
  #78 0x00007ff7a6809107 clang::driver::Driver::ExecuteCompilation(class clang::driver::Compilation &, class llvm::SmallVectorImpl<struct std::pair<int, class clang::driver::Command const *>> &) C:\src\llvm-project\clang\lib\Driver\Driver.cpp:1571:0
  #79 0x00007ff7a67c468e main /b/f/w/llvm-project/build/rel/../../clang/tools/driver/driver.cpp:510:0
  #80 0x00007ff7a9cd11e8 invoke_main d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0
  #81 0x00007ff7a9cd11e8 __scrt_common_main_seh d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
  #82 0x00007fff3e777c24 (C:\Windows\System32\KERNEL32.DLL+0x17c24)
  #83 0x00007fff3ecad721 (C:\Windows\SYSTEM32\ntdll.dll+0x6d721)
  clang-cl: error: clang frontend command failed due to signal (use -v to see invocation)
  clang version 13.0.0
  Target: x86_64-pc-windows-msvc
  Thread model: posix
  InstalledDir: ../rel/bin
  clang-cl: note: diagnostic msg:
  ********************
  
  PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
  Preprocessed source(s) and associated run script(s) are located at:
  clang-cl: note: diagnostic msg: C:\src\tmp\MasmParser-573e32.sh
  clang-cl: note: diagnostic msg:
  
  ********************
  ninja: build stopped: subcommand failed.

F17334336: MasmParser-44ec46.cpp <https://reviews.llvm.org/F17334336>

F17334334: MasmParser-44ec46.sh <https://reviews.llvm.org/F17334334>


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99696/new/

https://reviews.llvm.org/D99696



More information about the cfe-commits mailing list