<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/141533>141533</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Crash in `clang::Sema::CorrectTypo`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          RedNicStone
      </td>
    </tr>
</table>

<pre>
    I've encountered a crash in clang. I'm only reporting it here, I did not investigate it any further.
This error occurred after adding `-fmodules-cache-path` to the build command as either clang or cmake was failing to recompile modified module dependencies (deleting the module cache may temporarily fix that).

```
/usr/bin/ccache /usr/lib64/ccache/clang++ -I/home/nic/CLionProjects/ember-build/test/lib/doctest -I/home/nic/CLionProjects/ember-build/test/lib/nanobench/src/include -Wno-module-file-config-mismatch -march=native -mtune=native -fmodules -fmodules-cache-path=/home/nic/CLionProjects/ember-build/cmake-build-debug-clang-modules -g -std=gnu++23 -fcolor-diagnostics -MD -MT test/CMakeFiles/test-common-format.dir/core/common/format.cpp.o -MF test/CMakeFiles/test-common-format.dir/core/common/format.cpp.o.d @test/CMakeFiles/test-common-format.dir/core/common/format.cpp.o.modmap -o test/CMakeFiles/test-common-format.dir/core/common/format.cpp.o -c /home/nic/CLionProjects/ember-build/test/core/common/format.cpp
/home/nic/CLionProjects/ember-build/test/core/common/format.cpp:8:1: fatal error: module '_Builtin_stddef' is defined in both '/home/nic/CLionProjects/ember-build/cmake-build-debug-clang-modules/1ZCX7GDHMZICM/_Builtin_stddef-3A2VCGLXOAVXM.pcm' and '/home/nic/CLionProjects/ember-build/cmake-build-debug-clang-modules/26PDHLN8CXSV6/_Builtin_stddef-3A2VCGLXOAVXM.pcm'
 8 | import ember.core.common.format;
      | ^
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: /usr/bin/clang++ -I/home/nic/CLionProjects/ember-build/test/lib/doctest -I/home/nic/CLionProjects/ember-build/test/lib/nanobench/src/include -Wno-module-file-config-mismatch -march=native -mtune=native -fmodules -fmodules-cache-path=/home/nic/CLionProjects/ember-build/cmake-build-debug-clang-modules -g -std=gnu++23 -fcolor-diagnostics -MD -MT test/CMakeFiles/test-common-format.dir/core/common/format.cpp.o -MF test/CMakeFiles/test-common-format.dir/core/common/format.cpp.o.d @test/CMakeFiles/test-common-format.dir/core/common/format.cpp.o.modmap -o test/CMakeFiles/test-common-format.dir/core/common/format.cpp.o -c /home/nic/CLionProjects/ember-build/test/core/common/format.cpp
1.      /home/nic/CLionProjects/ember-build/test/core/common/format.cpp:12:1: current parser token 'void'
 #0 0x00007ff180227eea llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.20.1+0x227eea)
 #1 0x00007ff180224e74 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.20.1+0x224e74)
 #2 0x00007ff18013ec74 (/lib64/libLLVM.so.20.1+0x13ec74)
 #3 0x00007ff17fa26df0 __restore_rt (/lib64/libc.so.6+0x19df0)
 #4 0x00007ff18ae12fb7 clang::ASTIdentifierIterator::Next() (/lib64/libclang-cpp.so.20.1+0x2612fb7)
 #5 0x00007ff189b15c10 clang::Sema::makeTypoCorrectionConsumer(clang::DeclarationNameInfo const&, clang::Sema::LookupNameKind, clang::Scope*, clang::CXXScopeSpec*, clang::CorrectionCandidateCallback&, clang::DeclContext*, bool, clang::ObjCObjectPointerType const*, bool) (/lib64/libclang-cpp.so.20.1+0x1315c10)
 #6 0x00007ff189b171fe clang::Sema::CorrectTypo(clang::DeclarationNameInfo const&, clang::Sema::LookupNameKind, clang::Scope*, clang::CXXScopeSpec*, clang::CorrectionCandidateCallback&, clang::Sema::CorrectTypoKind, clang::DeclContext*, bool, clang::ObjCObjectPointerType const*, bool) (/lib64/libclang-cpp.so.20.1+0x13171fe)
 #7 0x00007ff18988d771 (/lib64/libclang-cpp.so.20.1+0x108d771)
 #8 0x00007ff18988d122 clang::Sema::ActOnUsingDirective(clang::Scope*, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, clang::SourceLocation, clang::IdentifierInfo*, clang::ParsedAttributesView const&) (/lib64/libclang-cpp.so.20.1+0x108d122)
 #9 0x00007ff188a51882 clang::Parser::ParseUsingDirective(clang::DeclaratorContext, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&) (/lib64/libclang-cpp.so.20.1+0x251882)
#10 0x00007ff188a514fa clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) (/lib64/libclang-cpp.so.20.1+0x2514fa)
#11 0x00007ff188a2ab1b clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/lib64/libclang-cpp.so.20.1+0x22ab1b)
#12 0x00007ff188b0ae11 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/lib64/libclang-cpp.so.20.1+0x30ae11)
#13 0x00007ff188b09796 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/lib64/libclang-cpp.so.20.1+0x309796)
#14 0x00007ff188a12bde clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.20.1+0x212bde)
#15 0x00007ff18b11514f clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.20.1+0x291514f)
#16 0x00007ff18b078b84 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.20.1+0x2878b84)
#17 0x00007ff18b1a8cae clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.20.1+0x29a8cae)
#18 0x0000563876db3687 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+++0xa687)
#19 0x0000563876daf727 (/usr/bin/clang+++0x6727)
#20 0x00007ff18ac192dd (/lib64/libclang-cpp.so.20.1+0x24192dd)
#21 0x00007ff18013e980 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib64/libLLVM.so.20.1+0x13e980)
#22 0x00007ff18ac18b95 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/lib64/libclang-cpp.so.20.1+0x2418b95)
#23 0x00007ff18abd4e59 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/lib64/libclang-cpp.so.20.1+0x23d4e59)
#24 0x00007ff18abd5117 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/lib64/libclang-cpp.so.20.1+0x23d5117)
#25 0x00007ff18abf7c69 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/lib64/libclang-cpp.so.20.1+0x23f7c69)
#26 0x0000563876daeb54 clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+++0x5b54)
#27 0x0000563876dbe978 main (/usr/bin/clang+++0x15978)
#28 0x00007ff17fa105f5 __libc_start_call_main (/lib64/libc.so.6+0x35f5)
#29 0x00007ff17fa106a8 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x36a8)
#30 0x0000563876dace05 _start (/usr/bin/clang+++0x3e05)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 20.1.2 (Fedora 20.1.2-3.fc42)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/lib64/llvm20/bin
Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang++.cfg
clang++: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /tmp/format-46a1c0.cpp
clang++: note: diagnostic msg: /tmp/format-46a1c0.cache
clang++: note: diagnostic msg: /tmp/

clang++: note: diagnostic msg: 

********************
```

Files requested as per note:
[format-46a1c0.tar.gz](https://github.com/user-attachments/files/20446167/format-46a1c0.tar.gz)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsWt9v27iT_2uUF0KGRFk__JAHxYnb7CVN0Hi7xb4YFDmyuZVILUmlyf31B1JyZDlOzm67d_gCWwSoRY1mPvOZ4QwpimjN1wLg3IsvvPjyjLRmI9X5Z2CfOH0wUsBZIdnz-bWH00dAIKhshQEFDBFEFdEbxAWiFRHrCbJCNZKiekYKGqkMF2vEDdqAAg_P0TVinCEhDeLiEbTha2LAChDxjMpWmQ2oiRfkyw3XCJSSCklKW-WslQYUIoxZnV4S-GUtWVuB9imhG_AbYjZeEiAjkdkAKlpeMURlXRPBENEIuNXeIUVSIVqTb4C-E41Kwiur1EikgMq64RWgWjJecmCos4IYNCAYCMpBIw9nDCpw7lljvYwDgmryjAzUjVRE8eoZlfwJmQ0xHp5Z3-xfEvR_Qe7hRauVhxcFFx5e0E7Hy2jFi2T6Mm5_WPwevvDwBfKvPbzYyNqOC049vJjfcCnulfwLqNEeXkBdgPIdFx5eGNCm0-nhBZPUXv-cEkGELEDQjYcXWtmHuaBVywD5fwjpd7z4Ja_Ap1KUfO3XXNfE0A3ya6LoxosuBTH8EZBfm1bAzvU2vuhgpKPL02C7cHdXPoOiXfuOSf_FyBr52jAvulyLtuMXR8gvqayk8hknayG14VQj__YS-bdL1BMxvyXfYMEr0D05vk06KfxSqpqYCeM2jlQqFz13y8OL_iZtmolE_u3i12mbMORNg1-nrpasJg3y5a90mKIfSrq3lXYz6ZdqjPLMi_LQi3JUEkOqriDZy366ezhdXbS8MlystGEMSg-niGvEoOQCmC2MhTQbK_hLk9XDi_DP-df0w-XH2z-v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