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