Bug 2396901 - rustc 1.90.0 segfaults on ppc64le on koji and copr
Summary: rustc 1.90.0 segfaults on ppc64le on koji and copr
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: llvm
Version: rawhide
Hardware: ppc64le
OS: Linux
high
high
Target Milestone: ---
Assignee: Nikita Popov
QA Contact: Fedora Extras Quality Assurance
URL: https://koji.fedoraproject.org/koji/t...
Whiteboard:
: 2397132 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-09-19 14:37 UTC by Petr Khartskhaev
Modified: 2025-09-26 02:44 UTC (History)
21 users (show)

Fixed In Version: llvm-21.1.2-1.fc44
Clone Of:
Environment:
Last Closed: 2025-09-26 02:44:23 UTC
Type: ---
Embargoed:
tstellar: mirror+


Attachments (Terms of Use)
reduced LLVM IR (4.57 KB, text/plain)
2025-09-20 16:51 UTC, Josh Stone
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-2336 0 None None None 2025-09-19 18:00:41 UTC

Description Petr Khartskhaev 2025-09-19 14:37:16 UTC
Compiling the crates `image` and `ravif` in my package that bundles many crates using cargo vendor causes rustc to segfault consistently since rust got updated to 1.90.0 in rawhide.

See:
https://koji.fedoraproject.org/koji/taskinfo?taskID=137251251
https://koji.fedoraproject.org/koji/taskinfo?taskID=137252050
https://koji.fedoraproject.org/koji/taskinfo?taskID=137252479
and
https://koji.fedoraproject.org/koji/taskinfo?taskID=137258470
, of which I have a build from yesterday that did not fail:
https://koji.fedoraproject.org/koji/taskinfo?taskID=137229007

This also happens in copr (compare the builds on f43 and rawhide):
https://copr.fedorainfracloud.org/coprs/pkhartsk/postgresql16-postgresql_anonymizer/build/9574325/

I'll try to test if this happens when using rustup, too, as I haven't yet.

Reproducible: Always

Steps to Reproduce:
1. Try to build https://kojipkgs.fedoraproject.org//work/tasks/2358/137252358/postgresql16-anonymizer-2.4.1-1.fc44.src.rpm in koji or copr (possibly on another ppc64le machine)

Actual Results:
SIGSEGV

Expected Results:
Successful build

Comment 1 Josh Stone 2025-09-19 18:00:34 UTC
I can reproduce this on rawhide, but not with rust-1.90.0-1.fc42 and llvm-20.1.8-4.fc42, so I suspect this is an LLVM 21 regression.

Here's a more detailed backtrace from a core dump:

#0  llvm::SDValue::getNode (this=<optimized out>) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:161
#1  llvm::simplify_type<llvm::SDValue const>::getSimplifiedValue (Val=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:277
#2  llvm::CastInfo<llvm::ConstantSDNode, llvm::SDValue const, void>::isPossible (f=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/include/llvm/Support/Casting.h:510
#3  llvm::isa<llvm::ConstantSDNode, llvm::SDValue> (Val=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/include/llvm/Support/Casting.h:549
#4  llvm::PPCTargetLowering::DAGCombineExtBoolTrunc (this=0x7fff2c06c028, N=0x7fff18c63730, DCI=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:15372
#5  llvm::PPCTargetLowering::PerformDAGCombine (this=0x7fff2c06c028, N=0x7fff18c63730, DCI=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:16726
#6  0x00007fff92d68af8 in (anonymous namespace)::DAGCombiner::combine (this=<optimized out>, N=<optimized out>) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2087
#7  0x00007fff92d649ec in (anonymous namespace)::DAGCombiner::Run (this=<optimized out>, AtLevel=<optimized out>) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1839
#8  llvm::SelectionDAG::Combine (this=<optimized out>, Level=<optimized out>, BatchAA=<optimized out>, OptLevel=<optimized out>) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:29832
#9  0x00007fff92d5c068 in llvm::SelectionDAGISel::CodeGenAndEmitDAG (this=0x7fff19745010) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:947
#10 0x00007fff9287e30c in llvm::SelectionDAGISel::SelectBasicBlock (this=0x7fff19745010, Begin=..., End=..., HadTailCall=<optimized out>) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:866
#11 llvm::SelectionDAGISel::SelectAllBasicBlocks (this=0x7fff19745010, Fn=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1886
#12 0x00007fff92e4fdd4 in llvm::SelectionDAGISel::runOnMachineFunction (this=0x7fff19745010, mf=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:604
#13 0x00007fff92e4fc00 in (anonymous namespace)::PPCDAGToDAGISel::runOnMachineFunction (this=0x7fff19745010, MF=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:169
#14 0x00007fff9311993c in llvm::SelectionDAGISelLegacy::runOnMachineFunction (this=0x7fff208feb90, MF=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:372
#15 0x00007fff92e3c128 in llvm::MachineFunctionPass::runOnFunction (this=0x7fff208feb90, F=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/CodeGen/MachineFunctionPass.cpp:108
#16 0x00007fff9299e004 in llvm::FPPassManager::runOnFunction (this=0x7fff251d91e0, F=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/IR/LegacyPassManager.cpp:1398
#17 0x00007fff9299d56c in llvm::FPPassManager::runOnModule (this=0x7fff251d91e0, M=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/IR/LegacyPassManager.cpp:1444
#18 0x00007fff929a1c14 in (anonymous namespace)::MPPassManager::runOnModule (this=0x7fff10d57580, M=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/IR/LegacyPassManager.cpp:1513
#19 llvm::legacy::PassManagerImpl::run (this=0x7fff1cdc5db0, M=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/IR/LegacyPassManager.cpp:531
#20 0x00007fff929a189c in llvm::legacy::PassManager::run (this=<optimized out>, this@entry=0x7fff23371d50, M=...) at /usr/src/debug/llvm-21.1.1-1.fc44.ppc64le/llvm/lib/IR/LegacyPassManager.cpp:1640
#21 0x00007fff9a6e872c in LLVMRustWriteOutputFile (Target=0x7fff5e173610, PMR=0x7fff23371d50, M=0x7fff5ed67ec0, Path=<optimized out>, DwoPath=0x0, RustFileType=<optimized out>, VerifyIR=true) at compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp:609
#22 0x00007fff99f7a4a8 in rustc_codegen_llvm::back::write::write_output_file (dcx=..., target=0x7fff5e173610, no_builtins=<optimized out>, m=0x7fff5ed67ec0, output=..., dwo_output=..., file_type=<optimized out>, self_profiler_ref=<optimized out>, verify_llvm_ir=<optimized out>) at compiler/rustc_codegen_llvm/src/back/write.rs:80
#23 0x00007fff99f7c7bc in rustc_codegen_llvm::back::write::codegen (cgcx=0x7fff637bb7a8, module=..., config=0x7fff683db0f0) at compiler/rustc_codegen_llvm/src/back/write.rs:969
#24 0x00007fff99f5ace0 in rustc_codegen_llvm::{impl#3}::codegen (cgcx=0x7fff637bb7a8, module=..., config=0x7fff683db0f0) at compiler/rustc_codegen_llvm/src/lib.rs:225
#25 rustc_codegen_ssa::back::write::execute_optimize_work_item<rustc_codegen_llvm::LlvmCodegenBackend> (cgcx=0x7fff637bb7a8, module=..., module_config=0x7fff683db0f0) at compiler/rustc_codegen_ssa/src/back/write.rs:886
#26 rustc_codegen_ssa::back::write::spawn_work::{closure#0}<rustc_codegen_llvm::LlvmCodegenBackend> () at compiler/rustc_codegen_ssa/src/back/write.rs:1784
#27 rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()> () at compiler/rustc_codegen_llvm/src/lib.rs:151
#28 std::sys::backtrace::__rust_begin_short_backtrace<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()> (f=...) at library/std/src/sys/backtrace.rs:158
#29 0x00007fff99f67f98 in std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()> () at library/std/src/thread/mod.rs:559
#30 core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>> (self=...) at library/core/src/panic/unwind_safe.rs:272
#31 std::panicking::catch_unwind::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>>, ()> (data=<error reading variable: Cannot access memory at address 0x0>) at library/std/src/panicking.rs:589
#32 std::panicking::catch_unwind<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>>> (f=...) at library/std/src/panicking.rs:552
#33 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>>, ()> (f=...) at library/std/src/panic.rs:359
#34 std::thread::{impl#0}::spawn_unchecked_::{closure#1}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()> () at library/std/src/thread/mod.rs:557
#35 core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>, ()> () at library/core/src/ops/function.rs:253
#36 0x00007fff9a6c06f0 in alloc::boxed::{impl#28}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> (self=..., args=<optimized out>) at library/alloc/src/boxed.rs:1971
#37 std::sys::pal::unix::thread::{impl#2}::new::thread_start (data=0x7fff4c0032e0) at library/std/src/sys/pal/unix/thread.rs:107
#38 0x00007fff9b75757c in start_thread (arg=0x7fff637bcdc0) at pthread_create.c:448
#39 0x00007fff9b803d58 in __GI___clone3 () at ../sysdeps/unix/sysv/linux/powerpc/powerpc64/clone3.S:114

Comment 2 Josh Stone 2025-09-20 16:51:18 UTC
Created attachment 2107120 [details]
reduced LLVM IR

With llvm-reduce, both the image and ravif reproducers came down the basically the same snippet, which is actually from rav1e. The attachment here is fine with "opt -O2 | llc", but llc crashes in "opt -O3 | lcc". This also fails with F42's llvm-20, so it isn't just a regression in 21. (Maybe some other change was required for Rust to get into the bad state when not minimized.)

In a build with assertions, as of LLVM main d38979dca24a, that looks like:

llc: /home/jistone/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1035: const llvm::SDValue& llvm::SDNode::getOperand(unsigned int) const: Assertion `Num < NumOperands && "Invalid child # of SDNode!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: llc
1.      Running pass 'Function Pass Manager' on module '<stdin>'.
2.      Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@"_ZN5rav1e7context10block_unit60_$LT$impl$u20$rav1e..context..cdf_context..ContextWriter$GT$18encode_coeff_signs17h10bce43b00a0fe54E"'
 #0 0x0000000002543ab8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/jistone/llvm-project/build/bin/llc+0x2543ab8)
 #1 0x0000000002540c87 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007fb09c428070 __restore_rt (/lib64/libc.so.6+0x1a070)
 #3 0x00007fb09c481e9c __pthread_kill_implementation (/lib64/libc.so.6+0x73e9c)
 #4 0x00007fb09c427f3e gsignal (/lib64/libc.so.6+0x19f3e)
 #5 0x00007fb09c40f6d0 abort (/lib64/libc.so.6+0x16d0)
 #6 0x00007fb09c40f639 __assert_perror_fail (/lib64/libc.so.6+0x1639)
 #7 0x0000000000412a60 llvm::SDNode::getValueType(unsigned int) const (.isra.0.cold) PPCISelLowering.cpp:0:0
 #8 0x0000000000a08701 llvm::PPCTargetLowering::DAGCombineExtBoolTrunc(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const (/home/jistone/llvm-project/build/bin/llc+0xa08701)
 #9 0x0000000000a09de6 llvm::PPCTargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const (/home/jistone/llvm-project/build/bin/llc+0xa09de6)
#10 0x0000000002169b66 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#11 0x000000000216bafd llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) (/home/jistone/llvm-project/build/bin/llc+0x216bafd)
#12 0x00000000022dbf89 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/jistone/llvm-project/build/bin/llc+0x22dbf89)
#13 0x00000000022e0251 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/jistone/llvm-project/build/bin/llc+0x22e0251)
#14 0x00000000022e19e1 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/jistone/llvm-project/build/bin/llc+0x22e19e1)
#15 0x0000000000995008 (anonymous namespace)::PPCDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) PPCISelDAGToDAG.cpp:0:0
#16 0x00000000022cbc53 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/home/jistone/llvm-project/build/bin/llc+0x22cbc53)
#17 0x00000000013fea17 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x0000000001a375f8 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/jistone/llvm-project/build/bin/llc+0x1a375f8)
#19 0x0000000001a379d5 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/jistone/llvm-project/build/bin/llc+0x1a379d5)
#20 0x0000000001a384d8 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/jistone/llvm-project/build/bin/llc+0x1a384d8)
#21 0x0000000000864f76 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#22 0x000000000075937e main (/home/jistone/llvm-project/build/bin/llc+0x75937e)
#23 0x00007fb09c411575 __libc_start_call_main (/lib64/libc.so.6+0x3575)
#24 0x00007fb09c411628 __libc_start_main.5 (/lib64/libc.so.6+0x3628)
#25 0x000000000085afe5 _start (/home/jistone/llvm-project/build/bin/llc+0x85afe5)
Aborted (core dumped)

Comment 3 Nikita Popov 2025-09-22 07:23:12 UTC
Upstream issue: https://github.com/llvm/llvm-project/issues/160040

Comment 4 Josh Stone 2025-09-22 16:19:31 UTC
*** Bug 2397132 has been marked as a duplicate of this bug. ***

Comment 5 Fabio Valentini 2025-09-25 15:56:03 UTC
Looks like this was fixed upstream, thank you!
Any idea how long it will take to get llvm 21.1.2 (or the fix backported to 21.1.1)?

Comment 6 Tulio Magno Quites Machado Filho 2025-09-25 17:11:42 UTC
It's already in progress for rawhide: https://koji.fedoraproject.org/koji/buildinfo?buildID=2829500

Comment 7 Fedora Update System 2025-09-25 23:01:10 UTC
FEDORA-2025-b5d8b24893 (flang-21.1.2-1.fc44, libclc-21.1.2-1.fc44, and 2 more) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-b5d8b24893

Comment 8 Fedora Update System 2025-09-26 02:44:23 UTC
FEDORA-2025-b5d8b24893 (flang-21.1.2-1.fc44, libclc-21.1.2-1.fc44, and 2 more) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.