<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/98594>98594</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Segfault with self-referential value
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
scottmcm
</td>
</tr>
</table>
<pre>
This was just me making a silly typo in IR, but it SEGVd so I figure I'd mention that fact here. If that's not considered a bug, do feel free to just close this.
<https://llvm.godbolt.org/z/br6x7Pje8>
```
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
The assertions build detects it nicely:
```
Only PHI nodes may reference their own value!
%t2 = add i128 %t2, %cc
Only PHI nodes may reference their own value!
%t3 = add i128 %t3, %cc
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++ -g -o /app/output.s -masm=intel -S -x ir -fcolor-diagnostics -fno-crash-diagnostics -O3 <source>
1. Optimizer
2. Running pass "verify" on module "<source>"
#0 0x0000000003a41e98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a41e98)
#1 0x0000000003a3fb8c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a3fb8c)
#2 0x000000000398a486 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x398a486)
#3 0x0000000003a36c0e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a36c0e)
#4 0x0000000000c7280a LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
#5 0x0000000003995503 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3995503)
#6 0x0000000003995668 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3995668)
#7 0x00000000034442b3 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x34442b3)
#8 0x0000000003cd803e llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3cd803e)
#9 0x0000000003413890 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3413890)
#10 0x0000000003ce887c (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 0x0000000003cebfe5 (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 0x0000000003cec99b 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-trunk/bin/clang+++0x3cec99b)
#13 0x000000000433299f clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x433299f)
#14 0x00000000045b9a69 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45b9a69)
#15 0x000000000453f2de clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x453f2de)
#16 0x00000000046a1f5e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x46a1f5e)
#17 0x0000000000c74b95 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc74b95)
#18 0x0000000000c6ddba ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#19 0x0000000004375819 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
#20 0x000000000398a3c4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x398a3c4)
#21 0x0000000004375e0f 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
#22 0x000000000433b885 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x433b885)
#23 0x000000000433c2ed 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+++0x433c2ed)
#24 0x0000000004343cf5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4343cf5)
#25 0x0000000000c71f65 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc71f65)
#26 0x0000000000b49864 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb49864)
#27 0x000070a1ab829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#28 0x000070a1ab829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#29 0x0000000000c6d86e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc6d86e)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWlFz2yoW_jXKC2OPhGRZevCD6yS3udNOM3G2rx6EjmxuEWgBJfb99Tsg2Raqc9vtxjt3djtpaiM45-M7H4eDKNGabQXAIph9CGa3N6Q1O6kWmkpjalrfFLI8LJ53TKNXotEfrTaoBlSTb0xsEUGacX5A5tBIxAR6eArwChWtQcyg9d1vX0ukJXpAFdu2CtBDgOclqkEYJgUyO2JQRahBO1AwReihcm0BnmskpEFUCs1KUFAigop2a22XElUAHFUKABnZAaJcakBmx_Q0CG-DcNn_jlc7YxodxMsA3wf4nvOXerqVZSG5mUq1DfD9nwG-L1S6nz_-AVkQ3_Uj07D_cV8fldwqUiMDqmaCGCjRKzM7ZJkjPIiXaP3wm51u130l64ZxUEiBaZWA0vaI4vyi7e738w4Q0RqUZUajomW8RCUYoEZbLgWjwA92IpdsfBH8gB4_PiAhS9CoJgekoAIFglpagCkkXwV6IbyFAEfdIIQCPDMYBfEtImWJWISzrsnyHOAZpf-x9fh76_HIekUM4QiUksrS5D5YKRWEfgPhqPug5DcQqJZlywFVshWlNUIdzcRpiRRSGShP7h8_3S3Xd0i3Rc1Mpx6koJHKWNH4qtgys2uLKZV1L5H-n0mj5B9ATYDvmdYt6ADfIyJKxATlb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