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

    <tr>
        <th>Summary</th>
        <td>
            clang: fatal error: error in backend: Broken module found, compilation aborted!
        </td>
    </tr>

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

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

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

<pre>
    Compiler explorer: https://godbolt.org/z/8TGc9z657.

The following program `small.c` triggers a crash in clang-18:

``` sh
% cat small.c
inline int bar () __attribute__ ((alias ("foo")));
void foo () { }


% clang -O0 small.c
available_externally alias must point to available_externally global value
ptr @bar
fatal error: error in backend: Broken module found, compilation aborted!
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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O0 <source>
1.  <eof> parser at end of file
2. Optimizer
 #0 0x000000000372dd18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x372dd18)
 #1 0x000000000372b9dc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x372b9dc)
 #2 0x0000000003674866 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3674866)
 #3 0x0000000003722d2e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3722d2e)
 #4 0x0000000000bece6a LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
 #5 0x000000000367f203 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x367f203)
 #6 0x000000000367f368 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x367f368)
 #7 0x0000000003126173 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3126173)
 #8 0x000000000398eb7e llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x398eb7e)
 #9 0x00000000030f59cc llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x30f59cc)
#10 0x000000000399ee30 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) BackendUtil.cpp:0:0
#11 0x00000000039a2216 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) BackendUtil.cpp:0:0
#12 0x00000000039a2829 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x39a2829)
#13 0x00000000049990bf clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49990bf)
#14 0x0000000005e9b6f9 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5e9b6f9)
#15 0x00000000049982a8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49982a8)
#16 0x00000000041fc4f9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x41fc4f9)
#17 0x000000000417d9ce clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x417d9ce)
#18 0x00000000042db54e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x42db54e)
#19 0x0000000000bef0e6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbef0e6)
#20 0x0000000000be69aa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x0000000003fd9c19 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
#22 0x00000000036747a4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x36747a4)
#23 0x0000000003fda20f 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
#24 0x0000000003fa23d5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fa23d5)
#25 0x0000000003fa2e3d 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+0x3fa2e3d)
#26 0x0000000003faad65 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3faad65)
#27 0x0000000000bec58c clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbec58c)
#28 0x0000000000ae6751 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xae6751)
#29 0x00007fb7305ba083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#30 0x0000000000be648e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbe648e)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
```

Clang version:

```
clang version 18.0.0 (https://github.com/llvm/llvm-project.git f2b79ed9c6c858426b15a0374103ab901b5b2ef3)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-assertions-trunk/bin
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWt9zozgS_mvIi8ouEBjDQx48Trw_aqYmNcnuq6uBhuhGSJwkEmf_-ishbCOS7Mzueu-u7qYyM7YQ6k9ff-puSQGtWSMQr4PVh2B1cwW9eZTqupRCNJyzq0JWL9db2XaMoyJ46LhUqIJ4Qx6N6XQQbwK6C-iukVUhuVlK1QR091tAd9nDD2X-W7paL4PwJgg37t-HRyS15Fw-M9GQTslGQUuCNNQtcL4sgzQkRrGmQaUJkFKBfiRMkJKDaBZRZg1OhgvS0P0Q_Ti20BUpwZDjeEMjE5wJJEwYUoAiAc0CmpP9HoxRrOgN7veuMQPOQLvPtJYyoDSg-fgTf3CjPUlWkVrK4zjB-gMJ1jcerjMWC5wsPoc-IngCxqHguMeDQSWA8xfijLe9NqSTFqyR5M2ODZcFcPIEvEc3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