2020-02-24 09:22:02 -06:00
|
|
|
// This should fail even without validation/SB
|
|
|
|
// compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
|
2017-09-16 04:39:51 -05:00
|
|
|
|
2017-01-31 03:36:46 -06:00
|
|
|
#![allow(dead_code, unused_variables)]
|
|
|
|
|
|
|
|
#[repr(packed)]
|
|
|
|
struct Foo {
|
|
|
|
x: i32,
|
|
|
|
y: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2020-08-17 10:09:09 -05:00
|
|
|
for _ in 0..10 { // Try many times as this might work by chance.
|
|
|
|
let foo = Foo {
|
|
|
|
x: 42,
|
|
|
|
y: 99,
|
|
|
|
};
|
|
|
|
let p = unsafe { &foo.x };
|
|
|
|
let i = *p; //~ ERROR alignment 4 is required
|
|
|
|
}
|
2017-06-22 23:01:24 -05:00
|
|
|
}
|