<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/138130>138130</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RISC-V] infinite loop with -fstack-clash-protection
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
andreas-schwab
</td>
</tr>
</table>
<pre>
https://gist.github.com/andreas-schwab/948c34cc8b519f5f9409c6e9a81cf3e6
$ clang++ -v -w -c sort_test.ii -fstack-clash-protection -std=c++17 -march=rv64gcv1p0
clang version 20.1.3
Target: riscv64-suse-linux
Thread model: posix
InstalledDir: /usr/bin
System configuration file directory: /etc/clang
User configuration file directory: /home/andreas/.config/clang
Found candidate GCC installation: /usr/bin/../lib64/gcc/riscv64-suse-linux/14
Selected GCC installation: /usr/bin/../lib64/gcc/riscv64-suse-linux/14
(in-process)
"/usr/bin/clang-20" -cc1 -triple riscv64-suse-linux -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name sort_test.ii -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu generic-rv64 -target-feature +m -target-feature +a -target-feature +f -target-feature +d -target-feature +c -target-feature +v -target-feature +zicsr -target-feature +zifencei -target-feature +zmmul -target-feature +zaamo -target-feature +zalrsc -target-feature +zve32f -target-feature +zve32x -target-feature +zve64d -target-feature +zve64f -target-feature +zve64x -target-feature +zvl128b -target-feature +zvl32b -target-feature +zvl64b -target-feature -b -target-feature -e -target-feature -h -target-feature -sha -target-feature -shcounterenw -target-feature -shgatpa -target-feature -shtvala -target-feature -shvsatpa -target-feature -shvstvala -target-feature -shvstvecd -target-feature -smaia -target-feature -smcdeleg -target-feature -smcsrind -target-feature -smdbltrp -target-feature -smepmp -target-feature -smmpm -target-feature -smnpm -target-feature -smrnmi -target-feature -smstateen -target-feature -ssaia -target-feature -ssccfg -target-feature -ssccptr -target-feature -sscofpmf -target-feature -sscounterenw -target-feature -sscsrind -target-feature -ssdbltrp -target-feature -ssnpm -target-feature -sspm -target-feature -ssqosid -target-feature -ssstateen -target-feature -ssstrict -target-feature -sstc -target-feature -sstvala -target-feature -sstvecd -target-feature -ssu64xl -target-feature -supm -target-feature -svade -target-feature -svadu -target-feature -svbare -target-feature -svinval -target-feature -svnapot -target-feature -svpbmt -target-feature -svvptc -target-feature -xcvalu -target-feature -xcvbi -target-feature -xcvbitmanip -target-feature -xcvelw -target-feature -xcvmac -target-feature -xcvmem -target-feature -xcvsimd -target-feature -xmipscmove -target-feature -xmipslsp -target-feature -xsfcease -target-feature -xsfvcp -target-feature -xsfvfnrclipxfqf -target-feature -xsfvfwmaccqqq -target-feature -xsfvqmaccdod -target-feature -xsfvqmaccqoq -target-feature -xsifivecdiscarddlone -target-feature -xsifivecflushdlone -target-feature -xtheadba -target-feature -xtheadbb -target-feature -xtheadbs -target-feature -xtheadcmo -target-feature -xtheadcondmov -target-feature -xtheadfmemidx -target-feature -xtheadmac -target-feature -xtheadmemidx -target-feature -xtheadmempair -target-feature -xtheadsync -target-feature -xtheadvdot -target-feature -xventanacondops -target-feature -xwchc -target-feature -za128rs -target-feature -za64rs -target-feature -zabha -target-feature -zacas -target-feature -zama16b -target-feature -zawrs -target-feature -zba -target-feature -zbb -target-feature -zbc -target-feature -zbkb -target-feature -zbkc -target-feature -zbkx -target-feature -zbs -target-feature -zca -target-feature -zcb -target-feature -zcd -target-feature -zce -target-feature -zcf -target-feature -zcmop -target-feature -zcmp -target-feature -zcmt -target-feature -zdinx -target-feature -zfa -target-feature -zfbfmin -target-feature -zfh -target-feature -zfhmin -target-feature -zfinx -target-feature -zhinx -target-feature -zhinxmin -target-feature -zic64b -target-feature -zicbom -target-feature -zicbop -target-feature -zicboz -target-feature -ziccamoa -target-feature -ziccif -target-feature -zicclsm -target-feature -ziccrse -target-feature -zicntr -target-feature -zicond -target-feature -zihintntl -target-feature -zihintpause -target-feature -zihpm -target-feature -zimop -target-feature -zk -target-feature -zkn -target-feature -zknd -target-feature -zkne -target-feature -zknh -target-feature -zkr -target-feature -zks -target-feature -zksed -target-feature -zksh -target-feature -zkt -target-feature -ztso -target-feature -zvbb -target-feature -zvbc -target-feature -zvfbfmin -target-feature -zvfbfwma -target-feature -zvfh -target-feature -zvfhmin -target-feature -zvkb -target-feature -zvkg -target-feature -zvkn -target-feature -zvknc -target-feature -zvkned -target-feature -zvkng -target-feature -zvknha -target-feature -zvknhb -target-feature -zvks -target-feature -zvksc -target-feature -zvksed -target-feature -zvksg -target-feature -zvksh -target-feature -zvkt -target-feature -zvl1024b -target-feature -zvl16384b -target-feature -zvl2048b -target-feature -zvl256b -target-feature -zvl32768b -target-feature -zvl4096b -target-feature -zvl512b -target-feature -zvl65536b -target-feature -zvl8192b -target-feature -experimental-sdext -target-feature -experimental-sdtrig -target-feature -experimental-smctr -target-feature -experimental-ssctr -target-feature -experimental-svukte -target-feature -experimental-xqcia -target-feature -experimental-xqciac -target-feature -experimental-xqcicli -target-feature -experimental-xqcicm -target-feature -experimental-xqcics -target-feature -experimental-xqcicsr -target-feature -experimental-xqciint -target-feature -experimental-xqcilo -target-feature -experimental-xqcilsm -target-feature -experimental-xqcisls -target-feature -experimental-zalasr -target-feature -experimental-zicfilp -target-feature -experimental-zicfiss -target-feature -experimental-zvbc32e -target-feature -experimental-zvkgs -target-feature +relax -target-abi lp64d -debugger-tuning=gdb -fdebug-compilation-dir=/home/andreas -v -fcoverage-compilation-dir=/home/andreas -resource-dir /usr/lib64/clang/20 -w -std=c++17 -fdeprecated-macro -ferror-limit 19 -fstack-clash-protection -fno-signed-char -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o sort_test.o -x c++-cpp-output sort_test.ii
clang -cc1 version 20.1.3 based upon LLVM 20.1.3 default target riscv64-suse-linux
#include "..." search starts here:
End of search list.
(gdb) bt
#0 llvm::ilist_traits<llvm::MachineInstr>::transferNodesFromList (
this=0x2aac06b928, FromList=..., First=..., Last=...)
at /usr/src/debug/llvm-20.1.3.src/lib/CodeGen/MachineBasicBlock.cpp:193
#1 llvm::iplist_impl<llvm::simple_ilist<llvm::MachineInstr, llvm::ilist_sentinel_tracking<true> >, llvm::ilist_traits<llvm::MachineInstr> >::transfer (
this=0x2aac06b928, position=..., L2=..., first=..., last=...)
at /usr/src/debug/llvm-20.1.3.src/include/llvm/ADT/ilist.h:228
#2 llvm::iplist_impl<llvm::simple_ilist<llvm::MachineInstr, llvm::ilist_sentinel_tracking<true> >, llvm::ilist_traits<llvm::MachineInstr> >::splice (
this=0x2aac06b928, where=..., L2=..., first=..., last=...)
at /usr/src/debug/llvm-20.1.3.src/include/llvm/ADT/ilist.h:276
#3 llvm::MachineBasicBlock::splice (this=0x2aac06b900, Where=...,
Other=0x2aabd78010, From=..., To=...)
at /usr/src/debug/llvm-20.1.3.src/include/llvm/CodeGen/MachineBasicBlock.h:1131
#4 emitStackProbeInline (MF=..., MBB=..., MBBI=..., DL=..., TargetReg=...,
IsRVV=<optimized out>)
at /usr/src/debug/llvm-20.1.3.src/lib/Target/RISCV/RISCVFrameLowering.cpp:2201
#5 llvm::RISCVFrameLowering::inlineStackProbe (this=<optimized out>, MF=...,
MBB=...)
at /usr/src/debug/llvm-20.1.3.src/lib/Target/RISCV/RISCVFrameLowering.cpp:2231
#6 0x0000003fede4a11a in (anonymous namespace)::PEI::insertPrologEpilogCode (
this=0x2ab626ccb0, MF=...)
at /usr/src/debug/llvm-20.1.3.src/lib/CodeGen/PrologEpilogInserter.cpp:1176
#7 (anonymous namespace)::PEI::runOnMachineFunction (this=<optimized out>,
MF=...)
at /usr/src/debug/llvm-20.1.3.src/lib/CodeGen/PrologEpilogInserter.cpp:263
#8 0x0000003fedd679de in llvm::MachineFunctionPass::runOnFunction (
this=0x2ab626ccb0, F=...)
at /usr/src/debug/llvm-20.1.3.src/lib/CodeGen/MachineFunctionPass.cpp:94
#9 0x0000003fedb2ea36 in llvm::FPPassManager::runOnFunction (
this=<optimized out>, F=...)
at /usr/src/debug/llvm-20.1.3.src/lib/IR/LegacyPassManager.cpp:1406
#10 0x0000003fedb34ebe in llvm::FPPassManager::runOnModule (this=0x2aabd479f0,
M=...) at /usr/src/debug/llvm-20.1.3.src/lib/IR/LegacyPassManager.cpp:1452
#11 0x0000003fedb2ef56 in (anonymous namespace)::MPPassManager::runOnModule (
this=0x2aad0bbf10, M=...)
at /usr/src/debug/llvm-20.1.3.src/lib/IR/LegacyPassManager.cpp:1521
#12 llvm::legacy::PassManagerImpl::run (this=0x2aad2dc5b0, M=...)
at /usr/src/debug/llvm-20.1.3.src/lib/IR/LegacyPassManager.cpp:539
#13 0x0000003ff5ff155a in (anonymous namespace)::EmitAssemblyHelper::RunCodegenPipeline (this=0x3fffff4e50, Action=<optimized out>,
OS=std::unique_ptr<llvm::raw_pwrite_stream> = {...}, DwoOS=...)
at /usr/src/debug/llvm-20.1.3.src/tools/clang/lib/CodeGen/BackendUtil.cpp:1228
#14 (anonymous namespace)::EmitAssemblyHelper::emitAssembly (
this=0x3fffff4e50, Action=<optimized out>,
OS=std::unique_ptr<llvm::raw_pwrite_stream> = {...}, BC=<optimized out>)
at /usr/src/debug/llvm-20.1.3.src/tools/clang/lib/CodeGen/BackendUtil.cpp:1252
#15 clang::emitBackendOutput (CI=..., CGOpts=..., TDesc=...,
M=<optimized out>, Action=<optimized out>, VFS=..., OS=...,
BC=0x2aaab54970)
at /usr/src/debug/llvm-20.1.3.src/tools/clang/lib/CodeGen/BackendUtil.cpp:1416
#16 0x0000003ff6335a42 in clang::BackendConsumer::HandleTranslationUnit (
this=0x2aaab54970, C=...)
at /usr/src/debug/llvm-20.1.3.src/tools/clang/lib/CodeGen/CodeGenAction.cpp:315
#17 0x0000003ff500365c in clang::ParseAST (S=..., PrintStats=<optimized out>,
SkipFunctionBodies=<optimized out>)
at /usr/src/debug/llvm-20.1.3.src/tools/clang/lib/Parse/ParseAST.cpp:184
#18 0x0000003ff6c508a2 in clang::FrontendAction::Execute (this=0x2aac064b50)
at /usr/src/debug/llvm-20.1.3.src/tools/clang/lib/Frontend/FrontendAction.cpp:1072
#19 0x0000003ff6be9026 in clang::CompilerInstance::ExecuteAction (
this=0x2aaab4c2e0, Act=...)
at /usr/src/debug/llvm-20.1.3.src/tools/clang/lib/Frontend/CompilerInstance.cpp:1056
#20 0x0000003ff6cbd018 in clang::ExecuteCompilerInvocation (Clang=0x2aaab4c2e0)
at /usr/src/debug/llvm-20.1.3.src/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:296
#21 0x0000002aaaaba4c4 in cc1_main (Argv=...,
Argv0=0x2aaab4a2a0 "/usr/bin/clang-20",
MainAddr=0x2aaaab69a8 <GetExecutablePath[abi:cxx11](char const*, bool)>)
at /usr/src/debug/llvm-20.1.3.src/tools/clang/tools/driver/cc1_main.cpp:290
#22 0x0000000300000000 in ?? ()
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUW11z4jiz_jXOjUqULRsCF7kgMMymanJmajI772VKltugRZYcSXYYfv0pGRMgNMmcPdmteqemKri7Jffz9IdkGbhzcqkBbqLhbTScX_HGr4y94bqwwB11YvXM86vcFL9uVt7XLkqnEVtEbLGUzg-W0q-afCBMFbHF6ZiILSbZWKSZEON8mEzKYTnJ4okYwYSPE1GmMIriafjPMiIU18uI3UbsltCW0GdCBXHG-kcPzg-kJLR0nos1FYq7Fa2t8SC8NJpQ54sonYvd6OSa0IpbsYrSuW1H2VK0SR1H8bS7A2nBujCIxYNkkEbx9Ae3S_BROiVWOtGOMuoaB1RJ3WyCemWBF6QyBahgVBsng_xOO8-VgmIubZBHbNE4G7FFLnUUTx9-OQ8VEUaXctlY3jlaSgWkkBaEN_ZXPwq8iNhiBz-e_unA_s6olangQHjEFoPdo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