Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std Atomic{I,U}{8,16}::fetch_{max,min} seem to broken on a few platform (LLVM bug) #2

Open
taiki-e opened this issue Feb 24, 2022 · 3 comments
Labels
C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream) O-aarch64 Target: Armv8-A, Armv8-R, or later processors in AArch64 mode O-arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state O-mips Target: MIPS processors O-powerpc Target: PowerPC processors

Comments

@taiki-e
Copy link
Owner

taiki-e commented Feb 24, 2022

std Atomic{I,U}{8,16}::fetch_{max,min} is currently broken for the following targets

portable-atomic/src/lib.rs

Lines 1458 to 1467 in 55b3d49

// HACK: the following operations are currently broken (at least on qemu):
// - aarch64's `AtomicI{8,16}::fetch_{max,min}` (release mode + lse)
// - armv5te's `Atomic{I,U}{8,16}::fetch_{max,min}`
// - mips's `AtomicI8::fetch_{max,min}` (release mode)
// - mipsel's `AtomicI{8,16}::fetch_{max,min}` (debug mode, at least)
// - mips64's `AtomicI8::fetch_{max,min}` (release mode)
// - mips64el's `AtomicI{8,16}::fetch_{max,min}` (debug mode, at least)
// - powerpc's `AtomicI{8,16}::fetch_{max,min}`
// - powerpc64's `AtomicI{8,16}::fetch_{max,min}` (debug mode, at least)
// - powerpc64le's `AtomicU{8,16}::fetch_{max,min}` (release mode + fat LTO)

I haven't checked if it's a bug in rustc or in qemu-user, but this crate contains a workaround for this problem.

portable-atomic implements a workaround for this bug, so users aren't affected by this bug. This issue itself is tracking the upstream bug.

@taiki-e taiki-e added the C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream) label Feb 24, 2022
@taiki-e taiki-e changed the title std Atomic{I,U}{8,16}::fetch_{max,min} seem to broken on a few platform (or qemu-user bug?) core::sync::atomic::Atomic{I,U}{8,16}::fetch_{max,min} seem to broken on a few platform (or qemu-user bug?) Feb 25, 2022
@taiki-e taiki-e changed the title core::sync::atomic::Atomic{I,U}{8,16}::fetch_{max,min} seem to broken on a few platform (or qemu-user bug?) std Atomic{I,U}{8,16}::fetch_{max,min} seem to broken on a few platform (or qemu-user bug?) Feb 27, 2022
@taiki-e
Copy link
Owner Author

taiki-e commented Jun 24, 2022

It seems armv5te's AtomicI{8,16}::compare_exchange is also broken: https://github.com/taiki-e/portable-atomic/runs/7041957669?check_suite_focus=true

@taiki-e
Copy link
Owner Author

taiki-e commented Aug 17, 2022

It seems to be reproducible without qemu: rust-lang/rust#100650

@taiki-e taiki-e changed the title std Atomic{I,U}{8,16}::fetch_{max,min} seem to broken on a few platform (or qemu-user bug?) std Atomic{I,U}{8,16}::fetch_{max,min} seem to broken on a few platform Aug 17, 2022
@taiki-e taiki-e changed the title std Atomic{I,U}{8,16}::fetch_{max,min} seem to broken on a few platform std Atomic{I,U}{8,16}::fetch_{max,min} seem to broken on a few platform (LLVM bug) Aug 9, 2023
@taiki-e
Copy link
Owner Author

taiki-e commented Oct 13, 2024

I tested MIPS targets because the problem on MIPS was supposedly fixed in LLVM 19, but it seems that only bit-endian's MIPS32R2 is actually fixed, other MIPS targets still have problems.
https://github.com/taiki-e/portable-atomic/actions/runs/11314088026

@taiki-e taiki-e added O-arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state O-powerpc Target: PowerPC processors O-aarch64 Target: Armv8-A, Armv8-R, or later processors in AArch64 mode O-mips Target: MIPS processors labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream) O-aarch64 Target: Armv8-A, Armv8-R, or later processors in AArch64 mode O-arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state O-mips Target: MIPS processors O-powerpc Target: PowerPC processors
Projects
None yet
Development

No branches or pull requests

1 participant