Skip to content

Assertion failed: 0 && "Invalid SLocOffset or bad function choice", file D:\...\llvm-msvc\clang\lib\Basic\SourceManager.cpp, line 928 #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xengpro opened this issue Apr 9, 2025 · 3 comments

Comments

@xengpro
Copy link

xengpro commented Apr 9, 2025

Tried to build windows KMDF driver with toolset 'LLVM-MSVC_KernelMode' with v777.3 and 777.2 but both failed with assertion:

1>PLEASE submit a bug report to https://github.com/backengineering/llvm-msvc/issues and include the crash backtrace, preprocessed source, and associated run script.
1>Stack dump:
1>0.	Program arguments: C:\\llvm\\bin\\clang-cl.exe -cc1 -triple aarch64-pc-windows-msvc19.42.34436 -emit-llvm-bc -flto=full -flto-unit -disable-free -clear-ast-before-backend -main-file-name Device.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu generic -target-feature +neon -target-feature +v8a -target-abi aapcs -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -fno-rtti-data -stack-protector 2 -fno-rtti -fdiagnostics-format msvc -fms-kernel -cfguard -gno-column-info -gcodeview -debug-info-kind=constructor -fdebug-compilation-dir=D:\\xxx\src\\kmd -object-file-name=D:\\xxx\src\\build\\ARM64\\Release\\Device.obj -ffunction-sections -fcoverage-compilation-dir=D:\\xxx\src\\kmd -resource-dir C:\\llvm\\lib\\clang\\777 -include "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\shared\\warning.h" -I ..\\include -I D:\\xxx\src\\build\\ARM64\\Release\\ -I D:\\xxx\src\\build\\ARM64\\Release\\ -D _KERNEL_MODE -D _ARM64_ -D ARM64 -D _USE_DECLSPECS_FOR_SAL=1 -D STD_CALL -D _WIN32_WINNT=0x0A00 -D WINVER=0x0A00 -D WINNT=1 -D NTDDI_VERSION=0xA000010 -D _ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 -D KMDF_VERSION_MAJOR=1 -D KMDF_VERSION_MINOR=15 -D ENABLE_WPP_RECORDER=1 -internal-isystem C:\\llvm\\lib\\clang\\777\\include -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\km\\crt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\km" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\shared" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\shared\\" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\wdf\\kmdf\\1.15" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.42.34433\\include" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.42.34433\\atlmfc\\include" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\VS\\include" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\ucrt" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\VS\\UnitTest\\include" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\um" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\winrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\cppwinrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8.1\\Include\\um" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.42.34433\\include" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.42.34433\\atlmfc\\include" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\VS\\include" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\ucrt" -internal-isystem "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\VS\\UnitTest\\include" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\um" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\shared" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\winrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\cppwinrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8.1\\Include\\um" -Os -WCL4 -Wno-error -Wsystem-headers -fdeprecated-macro -ferror-limit 4294967295 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -Wno-unused-function -Wno-unused-variable -Wno-unused-value -fms-compatibility-version=19.42.34436 -std=c++14 -fno-threadsafe-statics -fdelayed-template-parsing -fpack-struct=8 -fno-caret-diagnostics -vectorize-loops -vectorize-slp -target-feature -fmv -faddrsig -o D:\\xxx\src\\build\\ARM64\\Release\\Device.obj -x c++ Device.cpp
1>1.	<unknown> parser at unknown location
1>Exception Code: 0x80000003
1> #0 0x00007ff7d928c8bc HandleAbort D:\workspace\ML\software\LLVM\proj\llvm-msvc\llvm\lib\Support\Windows\Signals.inc:424:0
1> #1 0x00007ffee8929ea7 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x99ea7)
1> #2 0x00007ffee892bae9 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x9bae9)
1> #3 0x00007ffee893144f (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa144f)
1> #4 0x00007ffee892f381 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x9f381)
1> #5 0x00007ffee8931caf (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa1caf)
1> #6 0x00007ff7d97167b5 clang::SourceManager::getFileIDLoaded(unsigned int) const D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Basic\SourceManager.cpp:928:0
1> #7 0x00007ff7d97163fe clang::SourceManager::getFileIDSlow(unsigned int) const D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Basic\SourceManager.cpp:839:0
1> #8 0x00007ff7d9706be2 clang::SourceManager::getFileID(unsigned int) const D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\include\clang\Basic\SourceManager.h:1864:0
1> #9 0x00007ff7d9706c40 clang::SourceManager::getFileID(class clang::SourceLocation) const D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\include\clang\Basic\SourceManager.h:1148:0
1>#10 0x00007ff7d97069a1 clang::SourceManager::getDecomposedLoc(class clang::SourceLocation) const D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\include\clang\Basic\SourceManager.h:1276:0
1>#11 0x00007ff7e1c9d53f clang::RawComment::getRawTextSlow(class clang::SourceManager const &) const D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\AST\RawCommentList.cpp:161:0
1>#12 0x00007ff7deda8727 clang::RawComment::getRawText(class clang::SourceManager const &) const D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\include\clang\AST\RawCommentList.h:102:0
1>#13 0x00007ff7e1c9c7ad clang::RawComment::RawComment(class clang::SourceManager const &, class clang::SourceRange, struct clang::CommentOptions const &, bool) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\AST\RawCommentList.cpp:114:0
1>#14 0x00007ff7ded60404 clang::Sema::ActOnComment(class clang::SourceRange) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Sema\Sema.cpp:2425:0
1>#15 0x00007ff7deb6d911 `anonymous namespace'::ActionCommentHandler::HandleComment D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Parse\Parser.cpp:40:0
1>#16 0x00007ff7e22f81c4 clang::Preprocessor::HandleComment(class clang::Token &, class clang::SourceRange) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Lex\Preprocessor.cpp:1427:0
1>#17 0x00007ff7e22e13af clang::Lexer::SkipLineComment(class clang::Token &, char const *, bool &) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Lex\Lexer.cpp:2637:0
1>#18 0x00007ff7e22dbdc9 clang::Lexer::LexTokenInternal(class clang::Token &, bool) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Lex\Lexer.cpp:4096:0
1>#19 0x00007ff7e22d5c07 clang::Lexer::Lex(class clang::Token &) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Lex\Lexer.cpp:3648:0
1>#20 0x00007ff7deb783e6 clang::Preprocessor::CLK_Lexer(class clang::Preprocessor &, class clang::Token &) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\include\clang\Lex\Preprocessor.h:2906:0
1>#21 0x00007ff7e22f2979 clang::Preprocessor::Lex(class clang::Token &) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Lex\Preprocessor.cpp:875:0
1>#22 0x00007ff7deb7a1de clang::Parser::TryConsumeToken(enum clang::tok::TokenKind) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\include\clang\Parse\Parser.h:508:0
1>#23 0x00007ff7deb63e7a clang::Parser::ExpectAndConsumeSemi(unsigned int, class llvm::StringRef) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Parse\Parser.cpp:159:0
1>#24 0x00007ff7debbc275 clang::Parser::ParseDeclGroup(class clang::ParsingDeclSpec &, enum clang::DeclaratorContext, class clang::ParsedAttributes &, class clang::SourceLocation *, struct clang::Parser::ForRangeInit *) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Parse\ParseDecl.cpp:2414:0
1>#25 0x00007ff7deb68286 clang::Parser::ParseDeclOrFunctionDefInternal(class clang::ParsedAttributes &, class clang::ParsedAttributes &, class clang::ParsingDeclSpec &, enum clang::AccessSpecifier) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Parse\Parser.cpp:1239:0
1>#26 0x00007ff7deb6780b clang::Parser::ParseDeclarationOrFunctionDefinition(class clang::ParsedAttributes &, class clang::ParsedAttributes &, class clang::ParsingDeclSpec *, enum clang::AccessSpecifier) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Parse\Parser.cpp:1261:0
1>#27 0x00007ff7deb67050 clang::Parser::ParseExternalDeclaration(class clang::ParsedAttributes &, class clang::ParsedAttributes &, class clang::ParsingDeclSpec *) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Parse\Parser.cpp:1065:0
1>#28 0x00007ff7deb6026b clang::Parser::ParseTopLevelDecl(class clang::OpaquePtr<class clang::DeclGroupRef> &, enum clang::Sema::ModuleImportState &) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Parse\Parser.cpp:755:0
1>#29 0x00007ff7deb5b644 clang::ParseAST(class clang::Sema &, bool, bool) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Parse\ParseAST.cpp:163:0
1>#30 0x00007ff7dac7c922 clang::ASTFrontendAction::ExecuteAction(void) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Frontend\FrontendAction.cpp:1183:0
1>#31 0x00007ff7da7e5c27 clang::CodeGenAction::ExecuteAction(void) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\CodeGen\CodeGenAction.cpp:1153:0
1>#32 0x00007ff7dac7c20f clang::FrontendAction::Execute(void) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Frontend\FrontendAction.cpp:1069:0
1>#33 0x00007ff7dac3b83f clang::CompilerInstance::ExecuteAction(class clang::FrontendAction &) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\Frontend\CompilerInstance.cpp:1058:0
1>#34 0x00007ff7daf0a0f5 clang::ExecuteCompilerInvocation(class clang::CompilerInstance *) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\lib\FrontendTool\ExecuteCompilerInvocation.cpp:272:0
1>#35 0x00007ff7d616c579 cc1_main(class llvm::ArrayRef<char const *>, char const *, void *) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\tools\driver\cc1_main.cpp:306:0
1>#36 0x00007ff7d6151dfe ExecuteCC1Tool D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\tools\driver\driver.cpp:365:0
1>#37 0x00007ff7d61528af clang_main(int, char **, struct llvm::ToolContext const &) D:\workspace\ML\software\LLVM\proj\llvm-msvc\clang\tools\driver\driver.cpp:424:0
1>#38 0x00007ff7d619dfc6 main D:\workspace\ML\software\LLVM\proj\llvm-msvc\build\tools\clang\tools\driver\clang-driver.cpp:16:0
1>#39 0x00007ff7e2d5ef39 invoke_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:79:0
1>#40 0x00007ff7e2d5ee22 __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
1>#41 0x00007ff7e2d5ecde __scrt_common_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0
1>#42 0x00007ff7e2d5efce mainCRTStartup D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
1>#43 0x00007fffb226e8d7 (C:\WINDOWS\System32\KERNEL32.DLL+0x2e8d7)
1>#44 0x00007fffb335bf6c (C:\WINDOWS\SYSTEM32\ntdll.dll+0xbbf6c)
1>clang-cl : error : clang frontend command failed due to signal (use -v to see invocation)
1>clang version 777.2.2newworld (https://github.com/backengineering/llvm-msvc.git 34b54ee00c9c96cde6f4231385a4849b86ddfdc6)
1>Target: aarch64-pc-windows-msvc
1>Thread model: posix
1>InstalledDir: C:\llvm\bin
1>Done building project "xxx.vcxproj" -- FAILED.
@CR3Swapper
Copy link
Contributor

Can you try with debug llvm-msvc?

https://github.com/backengineering/llvm-msvc/releases/download/llvm-msvc-v777.1.9/llvm-msvc_X86_64_installer-PDB.exe

This comes with PDB and debug version, it will show cleaner stack trace and information about what happened.

@xengpro
Copy link
Author

xengpro commented Apr 9, 2025

Can you try with debug llvm-msvc?

https://github.com/backengineering/llvm-msvc/releases/download/llvm-msvc-v777.1.9/llvm-msvc_X86_64_installer-PDB.exe

This comes with PDB and debug version, it will show cleaner stack trace and information about what happened.

Thank you for the quick help. I tried this installer version and it can build successfully.

@xengpro
Copy link
Author

xengpro commented Apr 10, 2025

Can you try with debug llvm-msvc?

https://github.com/backengineering/llvm-msvc/releases/download/llvm-msvc-v777.1.9/llvm-msvc_X86_64_installer-PDB.exe

This comes with PDB and debug version, it will show cleaner stack trace and information about what happened.

Follow this lead, I downloaded windows-llvm-msvc-PDB.zip.00x of v777.2.2 and it can also build successfully. It seems to be caused by some options in my build cmd

@xengpro xengpro closed this as completed Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants