Skip to content

crossbeam-epoch internal::local_size unit test fails on 32-bit architectures #597

@decathorpe

Description

@decathorpe
failures:
---- internal::local_size stdout ----
thread 'internal::local_size' panicked at 'assertion failed: `(left == right)`
  left: `2040`,
 right: `1020`', src/internal.rs:379:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
    internal::local_size

The same error occurs on both i686 and armv7hl, on fedora rawhide, with stable Rust 1.47.0. The test is fine on all 64-bit architectures that are available to me (x86_64, aarch64, ppc64le, and s390x).

Looking at the source code for the failing test
https://github.com/crossbeam-rs/crossbeam/blob/master/crossbeam-epoch/src/internal.rs#L375

it seems the intent is to check if Local is equal or smaller than 2040 bytes (at least that's what the comment says), but the code in the test actually checks for equality: assert_eq!(2040, core::mem::size_of::<Local>());, not a "less than or equal" test.

Should this be changed to assert!(core::mem::size_of::<Local>() <= 2040); or something like that? I think this value is half the expected value because pointers are half as big on 32-bit architectures ... Or would it make sense to actually compare using a usize value (the architecture dependent pointer size)?

PS: Since this looks like an issue in the test and not a code issue, I'll ignore the failure for now, so fixing this is not urgent :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions