Open R-Goc opened 4 hours ago
@llvm/issue-subscribers-backend-x86
Author: None (R-Goc)
Not crashing on master. In fact not even hitting asserts on master.
Here is a full backtrace along with failed assert, from clang 19.1.0 debug:
Assertion failed: idx < size(), file C:\Users\rysza\lib\llvm-19\llvm\include\llvm/ADT/SmallVector.h, line 305
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: C:\\Users\\rysza\\bin\\LLVM19-dbg\\bin\\clang-cl.exe -cc1 -triple x86_64-pc-windows-msvc19.42.34321 -emit-obj -mincremental-linker-compatible -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name ts_gtest.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -fms-volatile -funwind-tables=2 -target-cpu x86-64 -target-feature +sse3 -target-feature +ssse3 -target-feature +sse4.1 -target-feature +popcnt -target-feature +sse4.2 -target-feature +avx -target-feature +f16c -target-feature +avx2 -target-feature +fma -mllvm -x86-asm-syntax=intel -tune-cpu generic -D_MT -D_DLL --dependent-lib=msvcrt --dependent-lib=oldnames --show-includes -sys-header-deps -stack-protector 2 -fcxx-exceptions -fexceptions -fasync-exceptions -fdiagnostics-format msvc -fdebug-compilation-dir=C:\\Users\\rysza\\lib\\opencv\\build -ffunction-sections -fcoverage-compilation-dir=C:\\Users\\rysza\\lib\\opencv\\build -D _USE_MATH_DEFINES -D _VARIADIC_MAX=10 -D _WIN32_WINNT=0x0601 -D __OPENCV_BUILD=1 -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D WIN32 -D _WINDOWS -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -D _SCL_SECURE_NO_WARNINGS -D NDEBUG -D NDEBUG -O3 -WCL4 -W -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -Wno-long-long -Wno-undef -fdeprecated-macro -ferror-limit 19 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.42.34321 -std=c++14 -finline-functions -fskip-odr-check-in-gmf -fdelayed-template-parsing -vectorize-loops -vectorize-slp -faddrsig -x c++ ts_gtest-cd8cab.cpp
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'ts_gtest-cd8cab.cpp'.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@"??$HandleSehExceptionsInMethodIfSupported@VTest@testing@@X@internal@testing@@YAXPEAVTest@1@P821@EAAXXZPEBD@Z"'
Exception Code: 0xC000001D
#0 0x00007ff79bd2f6e6 HandleAbort C:\Users\rysza\lib\llvm-19\llvm\lib\Support\Windows\Signals.inc:429:0
#1 0x00007fff57a2e6d5 (C:\Windows\System32\ucrtbase.dll+0x7e6d5)
#2 0x00007fff57a2f6e1 (C:\Windows\System32\ucrtbase.dll+0x7f6e1)
#3 0x00007fff57a3114a (C:\Windows\System32\ucrtbase.dll+0x8114a)
#4 0x00007fff57a3103d (C:\Windows\System32\ucrtbase.dll+0x8103d)
#5 0x00007fff57a312d1 (C:\Windows\System32\ucrtbase.dll+0x812d1)
#6 0x00007ff79d373f0d llvm::SmallVectorTemplateCommon<llvm::SEHUnwindMapEntry,void>::begin C:\Users\rysza\lib\llvm-19\llvm\include\llvm\ADT\SmallVector.h:281:0
#7 0x00007ff79d373f0d llvm::SmallVectorTemplateCommon<llvm::SEHUnwindMapEntry,void>::operator[] C:\Users\rysza\lib\llvm-19\llvm\include\llvm\ADT\SmallVector.h:306:0
#8 0x00007ff79d373f0d llvm::calculateSEHStateForAsynchEH(class llvm::BasicBlock const *, int, struct llvm::WinEHFuncInfo &) C:\Users\rysza\lib\llvm-19\llvm\lib\CodeGen\WinEHPrepare.cpp:0:0
#9 0x00007ff79d3742b4 llvm::calculateSEHStateNumbers(class llvm::Function const *, struct llvm::WinEHFuncInfo &) C:\Users\rysza\lib\llvm-19\llvm\lib\CodeGen\WinEHPrepare.cpp:608:0
#10 0x00007ff79d9c22a6 llvm::FunctionLoweringInfo::set(class llvm::Function const &, class llvm::MachineFunction &, class llvm::SelectionDAG *) C:\Users\rysza\lib\llvm-19\llvm\lib\CodeGen\SelectionDAG\FunctionLoweringInfo.cpp:114:0
#11 0x00007ff79d69d74e llvm::SelectionDAGISel::runOnMachineFunction(class llvm::MachineFunction &) C:\Users\rysza\lib\llvm-19\llvm\lib\CodeGen\SelectionDAG\SelectionDAGISel.cpp:598:0
#12 0x00007ff79c0d7b20 `anonymous namespace'::X86DAGToDAGISel::runOnMachineFunction C:\Users\rysza\lib\llvm-19\llvm\lib\Target\X86\X86ISelDAGToDAG.cpp:190:0
#13 0x00007ff79d69b647 llvm::SelectionDAGISelLegacy::runOnMachineFunction(class llvm::MachineFunction &) C:\Users\rysza\lib\llvm-19\llvm\lib\CodeGen\SelectionDAG\SelectionDAGISel.cpp:375:0
#14 0x00007ff79c02a25c llvm::MachineFunctionPass::runOnFunction(class llvm::Function &) C:\Users\rysza\lib\llvm-19\llvm\lib\CodeGen\MachineFunctionPass.cpp:96:0
#15 0x00007ff79bac5824 llvm::FPPassManager::runOnFunction(class llvm::Function &) C:\Users\rysza\lib\llvm-19\llvm\lib\IR\LegacyPassManager.cpp:1450:0
#16 0x00007ff79bace36d llvm::FPPassManager::runOnModule(class llvm::Module &) C:\Users\rysza\lib\llvm-19\llvm\lib\IR\LegacyPassManager.cpp:1486:0
#17 0x00007ff79bac61e1 `anonymous namespace'::MPPassManager::runOnModule C:\Users\rysza\lib\llvm-19\llvm\lib\IR\LegacyPassManager.cpp:1562:0
#18 0x00007ff79bac5f01 llvm::Module::getContext C:\Users\rysza\lib\llvm-19\llvm\include\llvm\IR\Module.h:301:0
#19 0x00007ff79bac5f01 llvm::legacy::PassManagerImpl::run(class llvm::Module &) C:\Users\rysza\lib\llvm-19\llvm\lib\IR\LegacyPassManager.cpp:542:0
#20 0x00007ff79cb3663e llvm::TimeTraceScope::~TimeTraceScope C:\Users\rysza\lib\llvm-19\llvm\include\llvm\Support\TimeProfiler.h:189:0
#21 0x00007ff79cb3663e `anonymous namespace'::EmitAssemblyHelper::RunCodegenPipeline C:\Users\rysza\lib\llvm-19\clang\lib\CodeGen\BackendUtil.cpp:1158:0
#22 0x00007ff79cb2bc61 std::unique_ptr<llvm::ToolOutputFile,std::default_delete<llvm::ToolOutputFile> >::operator bool C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34321\include\memory:3437:0
#23 0x00007ff79cb2bc61 `anonymous namespace'::EmitAssemblyHelper::EmitAssembly C:\Users\rysza\lib\llvm-19\clang\lib\CodeGen\BackendUtil.cpp:1182:0
#24 0x00007ff79cb2a4c2 std::unique_ptr<llvm::TargetMachine,std::default_delete<llvm::TargetMachine> >::operator bool C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34321\include\memory:3437:0
#25 0x00007ff79cb2a4c2 clang::EmitBackendOutput(class clang::DiagnosticsEngine &, class clang::HeaderSearchOptions const &, class clang::CodeGenOptions const &, class clang::TargetOptions const &, class clang::LangOptions const &, class llvm::StringRef, class llvm::Module *, enum clang::BackendAction, class llvm::IntrusiveRefCntPtr<class llvm::vfs::FileSystem>, class std::unique_ptr<class llvm::raw_pwrite_stream, struct std::default_delete<class llvm::raw_pwrite_stream>>, class clang::BackendConsumer *) C:\Users\rysza\lib\llvm-19\clang\lib\CodeGen\BackendUtil.cpp:1345:0
#26 0x00007ff79d1a3281 clang::BackendConsumer::HandleTranslationUnit(class clang::ASTContext &) C:\Users\rysza\lib\llvm-19\clang\lib\CodeGen\CodeGenAction.cpp:358:0
#27 0x00007ff79f2b3169 clang::ParseAST(class clang::Sema &, bool, bool) C:\Users\rysza\lib\llvm-19\clang\lib\Parse\ParseAST.cpp:191:0
#28 0x00007ff79d0678b3 clang::FrontendAction::Execute(void) C:\Users\rysza\lib\llvm-19\clang\lib\Frontend\FrontendAction.cpp:1082:0
#29 0x00007ff79be7fb6a llvm::Error::getPtr C:\Users\rysza\lib\llvm-19\llvm\include\llvm\Support\Error.h:278:0
#30 0x00007ff79be7fb6a llvm::Error::operator bool C:\Users\rysza\lib\llvm-19\llvm\include\llvm\Support\Error.h:242:0
#31 0x00007ff79be7fb6a clang::CompilerInstance::ExecuteAction(class clang::FrontendAction &) C:\Users\rysza\lib\llvm-19\clang\lib\Frontend\CompilerInstance.cpp:1061:0
#32 0x00007ff79bf5451d std::_Ptr_base<clang::CompilerInvocation>::get C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34321\include\memory:1312:0
#33 0x00007ff79bf5451d std::shared_ptr<clang::CompilerInvocation>::operator-> C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34321\include\memory:1768:0
#34 0x00007ff79bf5451d clang::CompilerInstance::getFrontendOpts C:\Users\rysza\lib\llvm-19\clang\include\clang\Frontend\CompilerInstance.h:312:0
#35 0x00007ff79bf5451d clang::ExecuteCompilerInvocation(class clang::CompilerInstance *) C:\Users\rysza\lib\llvm-19\clang\lib\FrontendTool\ExecuteCompilerInvocation.cpp:281:0
#36 0x00007ff79b858bd4 llvm::TimeTraceScope::~TimeTraceScope C:\Users\rysza\lib\llvm-19\llvm\include\llvm\Support\TimeProfiler.h:189:0
#37 0x00007ff79b858bd4 cc1_main(class llvm::ArrayRef<char const *>, char const *, void *) C:\Users\rysza\lib\llvm-19\clang\tools\driver\cc1_main.cpp:285:0
#38 0x00007ff79b85361f ExecuteCC1Tool C:\Users\rysza\lib\llvm-19\clang\tools\driver\driver.cpp:215:0
#39 0x00007ff79b8521f5 clang_main(int, char **, struct llvm::ToolContext const &) C:\Users\rysza\lib\llvm-19\clang\tools\driver\driver.cpp:256:0
#40 0x00007ff79b86d677 main C:\Users\rysza\lib\llvm-19\build\tools\clang\tools\driver\clang-driver.cpp:18:0
#41 0x00007ff7a1fe35d4 invoke_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0
#42 0x00007ff7a1fe35d4 __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#43 0x00007fff5932257d (C:\Windows\System32\KERNEL32.DLL+0x1257d)
#44 0x00007fff5a6caf28 (C:\Windows\SYSTEM32\ntdll.dll+0x5af28)
sh: C:\Users\rysza\bin\LLVM19-dbg\bin\clang-cl.exe: Error 0xc000001d
An lldb version of the backtrace:
(lldb) bt
* thread #1, stop reason = Exception 0xc000001d encountered at address 0x7ff79bd2f6e6
* frame #0: 0x00007ff79bd2f6e6 clang-cl.exe`HandleAbort(Sig=22) at Signals.inc:429
frame #1: 0x00007fff57a2e6d5 ucrtbase.dll`raise + 485
frame #2: 0x00007fff57a2f6e1 ucrtbase.dll`abort + 49
frame #3: 0x00007fff57a3114a ucrtbase.dll`_get_wpgmptr + 6554
frame #4: 0x00007fff57a3103d ucrtbase.dll`_get_wpgmptr + 6285
frame #5: 0x00007fff57a312d1 ucrtbase.dll`_wassert + 113
frame #6: 0x00007ff79d373f0d clang-cl.exe`llvm::calculateSEHStateForAsynchEH(BB=<unavailable>, State=<unavailable>, EHInfo=0x000002c6e663faf0) at SmallVector.h:305
frame #7: 0x00007ff79d3742b4 clang-cl.exe`llvm::calculateSEHStateNumbers(Fn=0x000002c6ef1be008, FuncInfo=0x000002c6e663faf0) at WinEHPrepare.cpp:608
frame #8: 0x00007ff79d9c22a6 clang-cl.exe`llvm::FunctionLoweringInfo::set(this=0x000002c6e867e880, fn=0x000002c6ef1be008, mf=0x000002c6ef3c4f70, DAG=0x000002c6eee97360) at FunctionLoweringInfo.cpp:114
frame #9: 0x00007ff79d69d74e clang-cl.exe`llvm::SelectionDAGISel::runOnMachineFunction(this=0x000002c6ef4c4fe0, mf=0x000002c6ef3c4f70) at SelectionDAGISel.cpp:596
frame #10: 0x00007ff79c0d7b20 clang-cl.exe``anonymous namespace'::X86DAGToDAGISel::runOnMachineFunction(this=0x000002c6ef4c4fe0, MF=0x000002c6ef3c4f70) at X86ISelDAGToDAG.cpp:190
frame #11: 0x00007ff79d69b647 clang-cl.exe`llvm::SelectionDAGISelLegacy::runOnMachineFunction(this=0x000002c6ec0028f0, MF=0x000002c6ef3c4f70) at SelectionDAGISel.cpp:374
frame #12: 0x00007ff79c02a25c clang-cl.exe`llvm::MachineFunctionPass::runOnFunction(this=0x000002c6ec0028f0, F=0x000002c6ef1be008) at MachineFunctionPass.cpp:94
frame #13: 0x00007ff79bac5824 clang-cl.exe`llvm::FPPassManager::runOnFunction(this=0x000002c6ec444190, F=0x000002c6ef1be008) at LegacyPassManager.cpp:1440
frame #14: 0x00007ff79bace36d clang-cl.exe`llvm::FPPassManager::runOnModule(this=0x000002c6ec444190, M=<unavailable>) at LegacyPassManager.cpp:1486
frame #15: 0x00007ff79bac61e1 clang-cl.exe``anonymous namespace'::MPPassManager::runOnModule(this=0x000002c6ef0e0260, M=0x000002c6e2dc76b0) at LegacyPassManager.cpp:1555
frame #16: 0x00007ff79bac5f01 clang-cl.exe`llvm::legacy::PassManagerImpl::run(this=0x000002c6ee9602f0, M=0x000002c6e2dc76b0) at LegacyPassManager.cpp:541
frame #17: 0x00007ff79cb3663e clang-cl.exe``anonymous namespace'::EmitAssemblyHelper::RunCodegenPipeline(this=0x000000d3b598d810, Action=<unavailable>, OS=0x000000d3b598d958, DwoOS=0x000000d3b598d718) at BackendUtil.cpp:1157
frame #18: 0x00007ff79cb2bc61 clang-cl.exe``anonymous namespace'::EmitAssemblyHelper::EmitAssembly(this=0x000000d3b598d810, Action=<unavailable>, OS=0x000000d3b598d958, BC=<unavailable>) at BackendUtil.cpp:1180
frame #19: 0x00007ff79cb2a4c2 clang-cl.exe`clang::EmitBackendOutput(Diags=0x000002c6e2d5d210, HeaderOpts=0x000002c6e2d4e8b0, CGOpts=<unavailable>, TOpts=0x000000d3b598da00, LOpts=0x000002c6e2d4e150, TDesc=0x000000d3b598db98, M=0x000002c6e2dc76b0, Action=Backend_EmitObj, VFS=0x000000d3b598dbc8, OS=0x000000d3b598dbc0, BC=0x000002c6e2dc65b0) at BackendUtil.cpp:1341
frame #20: 0x00007ff79d1a3281 clang-cl.exe`clang::BackendConsumer::HandleTranslationUnit(this=0x000002c6e2dc65b0, C=0x000002c6e2daff70) at CodeGenAction.cpp:354
frame #21: 0x00007ff79f2b3169 clang-cl.exe`clang::ParseAST(S=0x000002c6e2e059c0, PrintStats=<unavailable>, SkipFunctionBodies=<unavailable>) at ParseAST.cpp:184
frame #22: 0x00007ff79d0678b3 clang-cl.exe`clang::FrontendAction::Execute(this=0x000002c6e2d5c110) at FrontendAction.cpp:1078
frame #23: 0x00007ff79be7fb6a clang-cl.exe`clang::CompilerInstance::ExecuteAction(this=0x000002c6e2d4db70, Act=0x000002c6e2d5c110) at CompilerInstance.cpp:1061
frame #24: 0x00007ff79bf5451d clang-cl.exe`clang::ExecuteCompilerInvocation(Clang=0x000002c6e2d4db70) at ExecuteCompilerInvocation.cpp:280
frame #25: 0x00007ff79b858bd4 clang-cl.exe`cc1_main(Argv=<unavailable>, Argv0="\U00000010\xd2\xd5\xe2\xc6\U00000002", MainAddr=0x00007ff79b851070) at cc1_main.cpp:284
frame #26: 0x00007ff79b85361f clang-cl.exe`ExecuteCC1Tool(ArgV=0x000000d3b598e838, ToolContext=0x000000d3b598fdf8) at driver.cpp:215
frame #27: 0x00007ff79b8521f5 clang-cl.exe`clang_main(Argc=<unavailable>, Argv=<unavailable>, ToolContext=0x000000d3b598fdf8) at driver.cpp:256
frame #28: 0x00007ff79b86d677 clang-cl.exe`main(argc=134, argv=0x000002c6e2d49580) at clang-driver.cpp:17
frame #29: 0x00007ff7a1fe35d4 clang-cl.exe`__scrt_common_main_seh [inlined] invoke_main at exe_common.inl:288
frame #30: 0x00007ff7a1fe35b2 clang-cl.exe`__scrt_common_main_seh at exe_common.inl:288
frame #31: 0x00007fff5932257d kernel32.dll`BaseThreadInitThunk + 29
frame #32: 0x00007fff5a6caf28 ntdll.dll`RtlUserThreadStart + 40
Not sure why here the callstack is shorter. It looks like the assert didn't cause a trap somehow while running without lldb. The assert hit is:
304 reference operator[](size_type idx) {
-> 305 assert(idx < size());
306 return begin()[idx];
307 }
In SmallVector.h
ts_gtest-cd8cab.zip