Skip to content

rustc on SPARC miscompiled after LLVM 22 update #151813

@psumbera

Description

@psumbera

Rust nightly build on Solaris SPARC failed with:

Documenting stage2 library{alloc, compiler_builtins, core, panic_abort, panic_unwind, proc_macro, rustc-std-workspace-core, std, std_detect, sysroot, test, unwind} in JSON format (stage2 -> stage2, sparcv9-s
un-solaris)
   Compiling shlex v1.3.0
    Checking core v0.0.0 (/builds/psumbera/rust-lang-build/library/core)
   Compiling libc v0.2.178
   Compiling object v0.37.3
   Compiling std v0.0.0 (/builds/psumbera/rust-lang-build/library/std)
   Compiling test v0.0.0 (/builds/psumbera/rust-lang-build/library/test)
 Documenting core v0.0.0 (/builds/psumbera/rust-lang-build/library/core)
   Compiling cc v1.2.0
   Compiling compiler_builtins v0.1.160 (/builds/psumbera/rust-lang-build/library/compiler-builtins/compiler-builtins)
error: internal compiler error: compiler/rustc_mir_transform/src/validate.rs:81:25: broken MIR in Item(DefId(0:41125 ~ core[bf16]::slice::memchr::memchr_aligned::runtime)) (after phase change to runtime-opti
mized) at bb7[57]:
                                Cannot Ne compare incompatible types bool and option::Option<usize>
  --> library/core/src/slice/memchr.rs:91:24
   |
91 |                     if zu || zv {
   |                        ^^


thread 'rustc' (3) panicked at compiler/rustc_mir_transform/src/validate.rs:81:25:
Box<dyn Any>
stack backtrace:
   0: 0xffffffee559a958c - <unknown>
   1: 0xffffffee55a01648 - <unknown>
   2: 0xffffffee559bc8a0 - <unknown>
   3: 0xffffffee559780c8 - <unknown>
   4: 0xffffffee5599d754 - <unknown>
   5: 0xffffffee4d1220e0 - <unknown>
   6: 0xffffffee5599dbc0 - <unknown>
   7: 0xffffffee552d1c34 - <unknown>
   8: 0xffffffee552d0904 - <unknown>
   9: 0xffffffee552e24ac - <unknown>
  10: 0xffffffee552e5958 - <unknown>
  11: 0xffffffee54f0f3e0 - <unknown>
  12: 0xffffffee550b6d8c - <unknown>
  13: 0xffffffee550b6e00 - <unknown>
  14: 0xffffffee550b6534 - <unknown>
  15: 0xffffffee550b64cc - <unknown>
  16: 0xffffffee5202fe20 - <unknown>
  17: 0xffffffee5204dfb4 - <unknown>
  18: 0xffffffee51fad19c - <unknown>
  19: 0xffffffee51f6f9a0 - <unknown>
  20: 0xffffffee51f6e9c4 - <unknown>
  21: 0xffffffee53906a30 - <unknown>
  22: 0xffffffee53a0c188 - <unknown>
  23: 0xffffffee538109b4 - <unknown>
  24: 0xffffffee53c48b40 - <unknown>
  25: 0xffffffee54ea52ac - <unknown>
  26: 0xffffffee51faeba8 - <unknown>
  27: 0xffffffee51f9bec8 - <unknown>
  28: 0xffffffee51fc62ac - <unknown>
  29: 0xffffffee51facb9c - <unknown>
  30: 0xffffffee51f6f9a0 - <unknown>
  31: 0xffffffee51f6e9c4 - <unknown>
  32: 0xffffffee53906a30 - <unknown>
  33: 0xffffffee53a0c188 - <unknown>
  34: 0xffffffee538109b4 - <unknown>
  35: 0xffffffee53c48b40 - <unknown>
  36: 0xffffffee520eb0c0 - <unknown>
  37: 0xffffffee5390acf4 - <unknown>
  38: 0xffffffee53a313a4 - <unknown>
  39: 0xffffffee5380398c - <unknown>
  40: 0xffffffee53d1d2d8 - <unknown>
  41: 0xffffffee531e57c4 - <unknown>
  42: 0xffffffee531e22f0 - <unknown>
  43: 0xffffffee531e5d28 - <unknown>
  44: 0xffffffee53217b40 - <unknown>
  45: 0xffffffee531e5d34 - <unknown>
  46: 0xffffffee53217f58 - <unknown>
  47: 0xffffffee531e5d34 - <unknown>
  48: 0xffffffee531e4918 - <unknown>
  49: 0xffffffee53906ad4 - <unknown>
  50: 0xffffffee53a0c974 - <unknown>
  51: 0xffffffee53820670 - <unknown>
  52: 0xffffffee53d4677c - <unknown>
  53: 0xffffffee5465d270 - <unknown>
  54: 0xffffffee54658ac0 - <unknown>
  55: 0xffffffee5467c4e8 - <unknown>
  56: 0xffffffee54677424 - <unknown>
  57: 0xffffffee54788328 - <unknown>
  58: 0xffffffee4d31c264 - <unknown>
  59: 0xffffffee4d43f930 - <unknown>
  60: 0xffffffee4d0e3540 - <unknown>
  61: 0xffffffee4d0fb7b8 - <unknown>
  62: 0xffffffee4d0cbe28 - <unknown>
  63: 0xffffffee4d0b6550 - <unknown>
  64: 0xffffffee4d0d2dfc - <unknown>
  65: 0xffffffee4d0e2dfc - <unknown>
  66: 0xffffffee4d15aa38 - <unknown>
  67: 0xffffffee4d1606b8 - <unknown>
  68: 0xffffffee559a67a0 - <unknown>
  69: 0xffffffff7eec6c8c - <unknown>

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/builds/psumbera/rust-lang-build/rustc-ice-2026-01-28T13_58_04-23325.txt` to your bug report

note: rustc 1.95.0-nightly (466ea4e6c 2026-01-28) running on sparcv9-sun-solaris

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C embed-bitcode=yes -Z unstable-options -C force-frame-pointers=non-leaf -Z annotate-moves -Z unstable-options -Z macro-backtrace -C split-debuginfo=off -C prefer-dynamic -Z inline-mir -Z inline-mir-preserve-debug -Z mir_strip_debuginfo=locals-in-tiny-functions -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -Z binary-dep-depinfo -Z force-unstable-if-unmarked

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] optimizing MIR for `slice::memchr::memchr_aligned::runtime`
#1 [optimized_mir] optimizing MIR for `slice::memchr::memchr_aligned`
... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: could not compile `core` (lib)

Caused by:
  process didn't exit successfully: `/builds/psumbera/rust-lang-build/build/bootstrap/debug/rustc /builds/psumbera/rust-lang-build/build/bootstrap/debug/rustc --crate-name core --edition=2024 library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 --warn=unexpected_cfgs --check-cfg 'cfg(no_fp_fmt_parse)' --check-cfg 'cfg(feature, values(any()))' --check-cfg 'cfg(target_has_reliable_f16)' --check-cfg 'cfg(target_has_reliable_f16_math)' --check-cfg 'cfg(target_has_reliable_f128)' --check-cfg 'cfg(target_has_reliable_f128_math)' --check-cfg 'cfg(llvm_enzyme)' -Cembed-bitcode=yes -Zunstable-options -Cforce-frame-pointers=non-leaf --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("debug_refcell", "llvm_enzyme", "optimize_for_size", "panic_immediate_abort"))' -C metadata=780838703ac3b3f6 -C extra-filename=-402ce691bb5e6643 --out-dir /builds/psumbera/rust-lang-build/build/sparcv9-sun-solaris/stage2-std/sparcv9-sun-solaris/dist/deps --target sparcv9-sun-solaris -L dependency=/builds/psumbera/rust-lang-build/build/sparcv9-sun-solaris/stage2-std/sparcv9-sun-solaris/dist/deps -L dependency=/builds/psumbera/rust-lang-build/build/sparcv9-sun-solaris/stage2-std/dist/deps -Zannotate-moves '--check-cfg=cfg(feature,values(any()))' -Zunstable-options -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo` (exit status: 101)
warning: build failed, waiting for other jobs to finish...
Command `/builds/psumbera/rust-lang-build/build/sparcv9-sun-solaris/stage0/bin/cargo doc -Zwarnings --target sparcv9-sun-solaris -Zbinary-dep-depinfo -j 256 -Zroot-dir=/builds/psumbera/rust-lang-build -Zno-embed-metadata --profile=dist -p alloc -p compiler_builtins -p core -p panic_abort -p panic_unwind -p proc_macro -p rustc-std-workspace-core -p std -p std_detect -p sysroot -p test -p unwind --features 'backtrace panic-unwind compiler-builtins-c' --manifest-path /builds/psumbera/rust-lang-build/library/sysroot/Cargo.toml --no-deps --target-dir /builds/psumbera/rust-lang-build/build/sparcv9-sun-solaris/stage2-std/sparcv9-sun-solaris/json-doc -Zskip-rustdoc-fingerprint -Zrustdoc-map [workdir=/builds/psumbera/rust-lang-build]` failed with exit code 101
Created at: src/bootstrap/src/core/build_steps/doc.rs:795:21
Executed at: src/bootstrap/src/core/build_steps/doc.rs:828:22

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 2:35:52
gmake: *** [Makefile:93: dist] Error 1

The first bad commit was:

3510a9ad0c3c86226788faf3c0cd8027b2dbe6f2 is the first bad commit
commit 3510a9ad0c3c86226788faf3c0cd8027b2dbe6f2
Author: Nikita Popov [<nikita.ppv@gmail.com>](mailto:nikita.ppv@gmail.com)
Date:   Tue Jan 6 10:43:07 2026 +0100

    Update to LLVM 22

 .gitmodules      | 2 +-
 src/llvm-project | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-prioritizeIssue: Indicates that prioritization has been requested for this issue.O-solarisOperating system: SolarisWG-llvmWorking group: LLVM backend code generationneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions