<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/149023>149023</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang assertion failure at O2 "Assertion `MI->getOpcode() == TargetOpcode::INLINEASM_BR && "end of copy chain MUST be INLINEASM_BR"' failed."
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bi6c
</td>
</tr>
</table>
<pre>
Compiler Explorer: https://godbolt.org/z/or4reYhan
- generated by fuzzer
console:
```console
<source>:2:16: warning: unknown attribute 'noipa' ignored [-Wunknown-attributes]
2 | __attribute__((noipa))
| ^~~~~
clang: /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:12714: llvm::Register FollowCopyChain(llvm::MachineRegisterInfo&, llvm::Register): Assertion `MI->getOpcode() == TargetOpcode::INLINEASM_BR && "end of copy chain MUST be INLINEASM_BR"' 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 -fno-verbose-asm -c --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O2 <source>
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '<source>'.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@foo6'
#0 0x0000000003fb0ae8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fb0ae8)
#1 0x0000000003fadf14 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fadf14)
#2 0x0000000003ef26e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000075071dc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000075071dc969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000075071dc42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000075071dc287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000075071dc2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000075071dc39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x000000000555473b llvm::SelectionDAGBuilder::visitCallBrLandingPad(llvm::CallInst const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x555473b)
#10 0x000000000557a08e llvm::SelectionDAGBuilder::visitIntrinsicCall(llvm::CallInst const&, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x557a08e)
#11 0x0000000005582953 llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5582953)
#12 0x0000000005595de4 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5595de4)
#13 0x0000000005629f3d llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, bool&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5629f3d)
#14 0x000000000562aecd llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x562aecd)
#15 0x000000000562c375 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x562c375)
#16 0x0000000005617d7f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5617d7f)
#17 0x00000000032b1a93 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x00000000038d92af llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x38d92af)
#19 0x00000000038d9661 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x38d9661)
#20 0x00000000038d9ed1 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x38d9ed1)
#21 0x0000000004269bb1 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, 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+0x4269bb1)
#22 0x0000000004965923 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4965923)
#23 0x000000000665fb9c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x665fb9c)
#24 0x0000000004965d28 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4965d28)
#25 0x0000000004c5fa55 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4c5fa55)
#26 0x0000000004bdc73e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4bdc73e)
#27 0x0000000004d51891 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4d51891)
#28 0x0000000000d93aef cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd93aef)
#29 0x0000000000d8a6ca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#30 0x00000000049cce79 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
#31 0x0000000003ef2b84 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ef2b84)
#32 0x00000000049cd48f 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
#33 0x000000000498f45d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x498f45d)
#34 0x00000000049904ee 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+0x49904ee)
#35 0x0000000004999085 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4999085)
#36 0x0000000000d8ff9f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd8ff9f)
#37 0x0000000000c44cb4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc44cb4)
#38 0x000075071dc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#39 0x000075071dc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#40 0x0000000000d8a175 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd8a175)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
code:
```c
__attribute__((noipa))
int foo6(void) {
int x = 0, y = 1, z = 2, v = 3, w = 4;
asm goto(""
: "+a"(x), "+d"(y), "+c"(z), "+b"(v), "+S"(w)
:
:
: lab, lab2, lab3, lab4, lab5);
lab:
return foo6();
lab2:
return y;
lab3:
return z;
lab4:
return v;
lab5:
return w;
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWltv2zgW_jXMC-FAou4PeVCcuJtBOw3qzF6eDIqkHG5kUktSTtyH_vYFKcm6xG2TXc9gFlukkMzL4XfuhxSx1nwrGLsC0TWIbi5wYx6luip4TC4KSQ9XS7mrecUUvH2pK6mYAkEOH42pNQhygFYArbaSFrIyl1JtAVp9BWglVajYPx6xAF6-gFsmmMKGUVgcYNl8_coU8HLg5UQKLStmCXk5iL32r2_1chAstWwUYSC4BUGOQJD7sV3_GSvBxda-NuJJyGcBsTGKF41hEKBESF5jgBLIt0IqRiGIrhd_64YujkM1iG6Al0MIIYIgWcLN5ti32QCUApR2pDL75-Vu1OwfiG6_ffv2zfJT4RYUQCslpQFoVVX73aJW8p-M9D_tgxcArZaSsg9MALRas4oRw6W4yT_Mfl43vKJMXZK6tuyjxA_tCo5QkIMg_8K2XBum4EpWlXxeyvqwfMRcAJQOgz5h8sgF68feiVICFAO0PEHIchrkMNeaKQsCgtj7dLcAwe2Wmc81kZQ50WQQBDcguIEPWA09jtTdrx_vfr3N158211-gWyiGACEmKJQlJLI-QGIxwk-_rR9gweB4AkDIqq7EvGL0Enj5_cfbfH0LdVPsuIEYFs0WKlZLZaCRc1vk5rEpLoncjaQ91QHXumEaoBXEgkIuSNVQBs0jg0Rh_QgLTJ6MwoRZ8dSK1UoSpjWjsDNG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