Skip to content

[MIPS] AtomicI8 and AtomicI16 doctests for fn fetch_min() and fn fetch_max() began failing in nightly-2024-04-08 #123772

@martn3

Description

@martn3

Hello,

nightly-2024-04-08 regressed on the following tests on MIPS:

failures: library/core/src/sync/atomic.rs - sync::atomic::AtomicI16::fetch_max (line 3072) library/core/src/sync/atomic.rs - sync::atomic::AtomicI16::fetch_min (line 3072) library/core/src/sync/atomic.rs - sync::atomic::AtomicI16::fetch_min (line 3084) library/core/src/sync/atomic.rs - sync::atomic::AtomicI8::fetch_max (line 3036) library/core/src/sync/atomic.rs - sync::atomic::AtomicI8::fetch_min (line 3036) library/core/src/sync/atomic.rs - sync::atomic::AtomicI8::fetch_min (line 3048) test result: FAILED. 4537 passed; 6 failed; 37 ignored; 0 measured; 6 filtered out; finished in 315.73s 

I have bisected this to #123555 in the Rust repo and to llvm/llvm-project@fbb27d1 in the LLVM repo.

How to reproduce

  1. (On Debian 12) install a MIPS toolchain:
sudo apt install \ gcc-mipsel-linux-gnu \ libc6-mipsel-cross \ qemu-user
  1. Create a file main.rs with the following contents (which is a simplified snippet of the failing doctests mentioned above):
fn main() { let x = std::sync::atomic::AtomicI8::new(23); assert_eq!(x.fetch_max(42, std::sync::atomic::Ordering::SeqCst), 23); }
  1. Build it like this:
./x build --target mipsel-unknown-linux-gnu build/x86_64-unknown-linux-gnu/stage1/bin/rustc \ --target mipsel-unknown-linux-gnu \ -Clinker=mipsel-linux-gnu-gcc \ main.rs
  1. Run like this:
qemu-mipsel -L /usr/mipsel-linux-gnu main 

Expected

The program completes successfully.

Actual

The program fails like this:

thread 'main' panicked at src/main.rs:3:5: assertion `left == right` failed left: 0 right: 23 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 

Bisection

With src/llvm-project pointing to llvm/llvm-project@fbb27d1 the test also fails, but when pointing src/llvm-project to the parent commit (llvm/llvm-project@e74c167) the test passes.

So we can conclude that this regression was introduced by llvm/llvm-project@fbb27d1, which originates from llvm/llvm-project#77072.

Edit: See llvm/llvm-project#77072 for more discussion around this.

@rustbot label +O-MIPS +A-atomic +T-compiler +C-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-atomicArea: Atomics, barriers, and sync primitivesC-bugCategory: This is a bug.O-MIPSTarget: MIPS processorsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions