<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113078>113078</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang++] Crash due to backend error "Instruction does not dominate all uses!"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yype
</td>
</tr>
</table>
<pre>
Hello there, the following invalid test case crashes clang++ by triggering a backend error:
```cpp
int a() { float b[({ goto c; 0; }) + ({ ({ ({ c: 0; }); }); })]; }
```
Tested versions: clang 10 ~ trunk (assertions)
Example: https://godbolt.org/z/MThfoGr99
Stack dump:
```
Instruction does not dominate all uses!
%1 = load i32, ptr %tmp, align 4, !dbg !18
%add = add nsw i32 %1, %4, !dbg !30
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-19.1.0/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-14.2.0 -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <eof> parser at end of file
2. Optimizer
3. Running pass "verify" on module "<source>"
#0 0x0000000003ae9978 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3ae9978)
#1 0x0000000003ae766c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3ae766c)
#2 0x0000000003a30e66 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3a30e66)
#3 0x0000000003ade6ee llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3ade6ee)
#4 0x0000000000c8073a LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
#5 0x0000000003a3bee3 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3a3bee3)
#6 0x0000000003a3c048 (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3a3c048)
#7 0x00000000034e4973 (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x34e4973)
#8 0x0000000003d7fffe llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3d7fffe)
#9 0x00000000034b2f60 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x34b2f60)
#10 0x0000000003d90774 (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>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0
#11 0x0000000003d93f15 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) BackendUtil.cpp:0:0
#12 0x0000000003d948cb 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>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3d948cb)
#13 0x00000000043f908e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x43f908e)
#14 0x00000000064cc55c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x64cc55c)
#15 0x00000000043f9448 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x43f9448)
#16 0x0000000004684f59 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x4684f59)
#17 0x0000000004609f8e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x4609f8e)
#18 0x000000000476e2be clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x476e2be)
#19 0x0000000000c82b7f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0xc82b7f)
#20 0x0000000000c7bcda ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x000000000443cba9 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 0x0000000003a30da4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3a30da4)
#23 0x000000000443d19f 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 0x0000000004402c05 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x4402c05)
#25 0x000000000440366d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x440366d)
#26 0x000000000440b075 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x440b075)
#27 0x0000000000c7fe95 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0xc7fe95)
#28 0x0000000000b547a4 main (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0xb547a4)
#29 0x0000740b95429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#30 0x0000740b95429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#31 0x0000000000c7b78e _start (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0xc7b78e)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
```
Side note: I made an effort to avoid submitting a duplicate issue. However, `Instruction does not dominate all uses!` issues sometimes appear similar based on the stack trace and printed instructions. If you know of better root-cause analysis methods to adopt, please advise. Thanks!
The test case was generated by a fuzzer.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl9v2zgS_zTKC2FDomT9eciD4yTbLlps0WT31aDEkcwLRepIyon7cJ_9QEq2Rddpc0V8WNwturFNkTO_-c1wOBRJtGaNALgOFjfB4vaK9GYj1fVu18FVKenu-gNwLpHZgIIAr-wXVEvO5TMTDWJiSzijyIA2qCIaUKWI3oBGFSeiCfBNgG9QuUNGsaYBZccQVJLqCQRFoJRUQbwMwtsg3P9Nw-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