Bug 2553620

Summary: Broken "sext" with Rust 1.99.0 and LLVM 23
Product: [Fedora] Fedora Reporter: Josh Stone <jistone>
Component: llvmAssignee: Tom Stellard <tstellar>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: code, decathorpe, dmalcolm, fedora-llvm-team, jakub, jchecahi, jistone, kkleine, npopov, scottt.tw, sergesanspaille, siddharth.kde, suraj.ghimire7, tbaeder, tstellar, tuliom
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2550296    

Description Josh Stone 2026-10-15 17:27:45 UTC
Koschei found a regression on ppc64le for the "libcramjam" Rust crate:
https://koschei.fedoraproject.org/package/rust-libcramjam?

One of its test binaries failed to build:

sext source and destination must both be a vector or neither
  %1220 = sext <4 x i32> %1218 to i64, !dbg !428653
sext source and destination must both be a vector or neither
  %1221 = sext <4 x i32> %1219 to i64, !dbg !428654
sext source and destination must both be a vector or neither
  %1319 = sext <4 x i32> %1317 to i64, !dbg !428743
sext source and destination must both be a vector or neither
  %1320 = sext <4 x i32> %1318 to i64, !dbg !428744
in function _RNvNtCsb33MiWvTZAZ_13libbz2_rs_sys8compress14compress_block
rustc-LLVM ERROR: Broken function found, compilation aborted!

I was able to reproduce this with the upstream Rust toolchain, and bisecting nightly builds came to the LLVM 23 upgrade. With extracted and reduced bitcode, I bisected LLVM to this commit:

https://github.com/llvm/llvm-project/commit/84f4b1e52df736d4bd0bcf821c7fbe06f3534042

Then I found an LLVM issue which happens to be on the same Rust function, though for x86-64 with AVX-512 instead.
https://github.com/llvm/llvm-project/issues/229609

And this is fixed on main in:
https://github.com/llvm/llvm-project/pull/229927

I've confirmed that this fixes the issue for my ppc64le bitcode as well. I asked on the PR for a 23.x backport, but if that doesn't happen then perhaps we can patch it in Fedora ourselves.

Comment 1 Fabio Valentini 2026-10-24 13:59:23 UTC
There's at least one more affected application:
https://koschei.fedoraproject.org/package/rust-sequoia-chameleon-gnupg

Comment 2 Tulio Magno Quites Machado Filho 2026-11-03 14:22:49 UTC
Status update: I've been working on the backport for this. The PR depends on many other changes for LLVM 24. I'm still working on this and need more time.

Comment 3 Fabio Valentini 2026-11-03 16:31:53 UTC
Thanks for the update. Would temporarily switching rustc back to use LLVM 22 to avoid this issue be an option?

Comment 4 Josh Stone 2026-11-03 18:44:09 UTC
As a more targeted workaround, you could use this in the affected packages:

%global build_rustflags %{build_rustflags} -Cno-vectorize-loops

... perhaps only for the specific arch as well.

(It helps that this is a hard error, rather than a silent miscompilation...)

Comment 5 Fabio Valentini 2026-11-03 22:47:11 UTC
Can confirm that this works as a workaround, thanks!
(see https://src.fedoraproject.org/rpms/rust-sequoia-chameleon-gnupg/c/ea00539 )

Comment 6 Ben Beasley 2026-11-04 10:24:03 UTC
(In reply to Fabio Valentini from comment #5)
> Can confirm that this works as a workaround, thanks!
> (see
> https://src.fedoraproject.org/rpms/rust-sequoia-chameleon-gnupg/c/ea00539 )

Similarly in python-cramjam[1], rust-libcramjam, and rust-libcramjam0.8.

[1] https://src.fedoraproject.org/rpms/python-cramjam/c/9c911bf38f00d01806fe2bbd420e568589da5797?branch=rawhide

Comment 7 Tulio Magno Quites Machado Filho 2026-11-16 14:43:07 UTC
A fix for this has been merged upstream and is expected to be included in LLVM 23.1.6.
https://github.com/llvm/llvm-project/pull/242057