2017-09-16 04:39:51 -05:00
|
|
|
// This should fail even without validation
|
2018-10-24 10:17:44 -05:00
|
|
|
// compile-flags: -Zmiri-disable-validation
|
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() {
|
|
|
|
let foo = Foo {
|
|
|
|
x: 42,
|
|
|
|
y: 99,
|
|
|
|
};
|
2017-12-05 10:06:03 -06:00
|
|
|
let p = unsafe { &foo.x };
|
2018-10-19 04:50:17 -05:00
|
|
|
let i = *p; //~ ERROR tried to access memory with alignment 1, but alignment 4 is required
|
2017-06-22 23:01:24 -05:00
|
|
|
}
|