-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateP-highHigh priorityHigh priorityregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
The code below does not run correctly under aarch64 on the nightly compiler in debug mode.
Every other combination works (only tried nightly and stable releases).
I minimized the sample as far as I could and verified it on real hardware.
Sorry for the title, I have no clue how to name this issue.
I tried this code:
#[derive(Debug, PartialEq)]
pub struct B {
pub b1: u16,
pub b2: u8,
}
impl B {
fn new(b1: u16, b2: u8) -> B {
B { b1, b2 }
}
}
#[test]
fn welp() {
assert_eq!(B::new(0xDEAD, 0xFE), B { b1: 0xDEAD, b2: 0xFE });
}
I expected to see this happen:
$ cargo +nightly test
[...]
test welp ... ok
Instead, this happened:
(qemu-aarch64)
$ cargo +nightly test
[...]
test welp ... thread 'welp' panicked at 'assertion failed: `(left == right)`
left: `B { b1: 0, b2: 0 }`,
right: `B { b1: 57005, b2: 254 }`', src/lib.rs:15:5
(aarch64 cpu)
left: `B { b1: 127, b2: 0 }`,
right: `B { b1: 57005, b2: 254 }`', src/lib.rs:15:5
Meta
You can reproduce this with qemu-user (aarch64) with the following config:
$ cat .cargo/config
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
runner = "qemu-aarch64"
$ LD_LIBRARY_PATH="/usr/aarch64-linux-gnu/lib:$LD_LIBRARY_PATH" cargo +nightly test --target aarch64-unknown-linux-gnu
CPU:
$ lscpu
Architecture: aarch64
Byte Order: Little Endian
[...]
$ cat /proc/cpuinfo
[...]
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
[...]
rustc --version --verbose
:
rustc 1.26.0-nightly (3eeb5a665 2018-03-01)
binary: rustc
commit-hash: 3eeb5a665e313c5b281820099e04d4c6c8188b46
commit-date: 2018-03-01
host: x86_64-unknown-linux-gnu
release: 1.26.0-nightly
LLVM version: 6.0
Edit: smaller example
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateP-highHigh priorityHigh priorityregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.