Closed
Description
The build for PR #42882 failed on ARM machines only. The failure is baffling and makes no sense at all. I managed to reproduce it on my Raspberry Pi and then tried minimizing the code bit by bit. This is the smallest example I have that demonstrates the problem:
#![feature(rand)]
use std::__rand::thread_rng;
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
static GLOBAL: AtomicUsize = ATOMIC_USIZE_INIT;
struct Foo(usize);
impl Drop for Foo {
fn drop(&mut self) {
assert!(self.0 == 0);
GLOBAL.fetch_add(0, Ordering::Relaxed);
GLOBAL.fetch_add(0, Ordering::Relaxed);
}
}
fn main() {
let len = 1;
for &modulus in &[100, 100] {
println!("len = {}, modulus = {}", len, modulus);
let _rng = thread_rng();
(0..len).map(|_| Foo(0 % modulus)).collect::<Vec<_>>();
}
}
Running in debug mode is all right:
Running `target/debug/vector-sort-panic-safe`
len = 1, modulus = 100
len = 1, modulus = 100
But running in release mode prints out weird stuff:
Running `target/release/vector-sort-panic-safe`
len = 1, modulus = 100
len = 1, modulus = 100
len = 1, modulus = 3785379840
len = 1, modulus = 3800891488
len = 1, modulus = 3959422609
len = 1, modulus = 3800891468
len = 1, modulus = 3959422587
len = 1, modulus = 3785359365
len = 1, modulus = 3959422388
len = 1, modulus = 3785379840
len = 1, modulus = 3942645753
len = 1, modulus = 100
len = 1, modulus = 100
Environment:
$ rustc --version
rustc 1.20.0-nightly (c9bb93576 2017-06-24)
$ cargo --version
cargo 0.21.0-nightly (d26fd6f08 2017-06-20)
$ uname -a
Linux raspberrypi 4.4.11-v7+ #888 SMP Mon May 23 20:10:33 BST 2016 armv7l GNU/Linux