<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112086>112086</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-19: Assertion `0 && "Invalid SLocOffset or bad function choice"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
iamanonymouscs
</td>
</tr>
</table>
<pre>
### Description
I encountered a crash in Clang when compiling my source code with the following two options:
`-objcmt-migrate-all` `-static-libsan`
These options together seem to trigger an internal error in the compiler, resulting in a crash. The issue occurs consistently with my project when both options are used. When I remove either option, the crash does not occur, so the combination seems to be the cause.
The issue can also be reproduced on Compiler Explorer.https://godbolt.org/z/3Mx3zdeeT
### Code
[txc_compress_dxtn.zip](https://github.com/user-attachments/files/17349267/txc_compress_dxtn.zip)
### Command
```sh
clang txc_compress_dxtn.i -objcmt-migrate-all -static-libsan -c -o txc_compress_dxtn
```
### Output
```sh
clang: /root/llvm-project/clang/lib/Basic/SourceManager.cpp:866: clang::FileID clang::SourceManager::getFileIDLoaded(clang::SourceLocation::UIntTy) const: Assertion `0 && "Invalid SLocOffset or bad function choice"' failed.
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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -objcmt-migrate-all -static-libsan <source>
1. <eof> parser at end of file
#0 0x0000000003baa4b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3baa4b8)
#1 0x0000000003ba817c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ba817c)
#2 0x0000000003af53d8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007256a6642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007256a66969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007256a6642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007256a66287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007256a662871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007256a6639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000003df5473 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3df5473)
#10 0x0000000003dfd14a (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3dfd14a)
#11 0x0000000005b61f6d (anonymous namespace)::ObjCMigrateASTConsumer::HandleTranslationUnit(clang::ASTContext&) ObjCMT.cpp:0:0
#12 0x00000000047f7488 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47f7488)
#13 0x000000000664051c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x664051c)
#14 0x00000000045029b8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45029b8)
#15 0x00000000047bc2b9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47bc2b9)
#16 0x000000000473ae5e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x473ae5e)
#17 0x00000000048a1e2e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x48a1e2e)
#18 0x0000000000cdb89f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcdb89f)
#19 0x0000000000cd35aa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#20 0x0000000004546689 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#21 0x0000000003af5884 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3af5884)
#22 0x0000000004546c7f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#23 0x000000000450c5bd clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x450c5bd)
#24 0x000000000450d6ad clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x450d6ad)
#25 0x0000000004514fd5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4514fd5)
#26 0x0000000000cd876f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcd876f)
#27 0x0000000000ba7cc4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xba7cc4)
#28 0x00007256a6629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#29 0x00007256a6629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#30 0x0000000000cd305e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcd305e)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWV1z4ygW_TXkhZJLQrI-HvLgduLdTHVXd00yu48uhK5sphG4ACVO__otQHaMk85Mdjz7slOZSpqPe889HC4XQY3hGwlwjeaf0Pzmio52q_Q1pwOVSj4PajTMXLWqe75GJA8_-AYM03xnuZIovUHp4g6DZGqUFjR0mGKmqdliLvFSULnBT1uQmKlhxwWXGzw8Y6NGzQAz1QF-4naL7RZwr4RQT26EfVJYefsG5YvgA5Vpotrf2WCTgW80tZBQIVCZYtdjLLWcJYK3hkpUpmHOwxYMHCxhqzZgt6CxARiwVdhqvtmAxlRi7rBLKjBorbSD7hAFzKARWWINZhTWoePyEOIMP2wBc2NGwIqxURvMlDTcWJBWPIfQhme80-p3YDYQ0Sq7PWKiGvBooJvhf7u-O6xhUI-AgXukYZhz7-F4WjsFBktlg0fXZ9QBbcsldTN8iC5i3ELoo6OB2cTkgZsJOaMSU2H8WA07rbqRQYeVxMspfny73wmlQc-21u78mpAVIquN6lol7EzpDSKrH4is8i_7_EcH8HDq6kU5S9XB1Db_ZPds7RjWYMy621s5-8F3aH6DSH3mhtvt2M6YGhBZjQZ0Qq2lbDuAtAaRVc8FuN9ZlRcNKStEVm_bJs3PYA0DlR0-Ki38mG1oYF7Fr01y_IYicaxFnDCcqNeTz1y9jevraHejfQ8VyhcYkZVWyiKyEuJxSCaxIbIKI8hK8BaR1SdqOENkde_33hcq6Qb0jO12KF_UZeksHUyifLHiAu5uTluieaFpAzaM-6xoBx0i9avxnxXzigxtv91J-_CMSOP3iXU-F8aA9ppFZZpiREpESowIuZOPVPAO339W7GvfG7BYadzSDvejZH4G2yrOABGCSIV7ygV0k8a_fb5d3N9iM7YDt5jidtw4bStt3aZ4R16OwtdM-o3iJIadTLhkYuzgZE-2lH23mjosS7zzm4i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