2018-12-21 16:12:15 -06:00
|
|
|
// compile-flags: -C no-prepopulate-passes
|
|
|
|
|
|
|
|
#![crate_type="rlib"]
|
|
|
|
|
|
|
|
#[repr(align(16))]
|
|
|
|
pub struct S {
|
|
|
|
arr: [u32; 4],
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test1
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: store i32 0, {{i32\*|ptr}} %{{.+}}, align 16
|
|
|
|
// CHECK: store i32 1, {{i32\*|ptr}} %{{.+}}, align 4
|
|
|
|
// CHECK: store i32 2, {{i32\*|ptr}} %{{.+}}, align 8
|
|
|
|
// CHECK: store i32 3, {{i32\*|ptr}} %{{.+}}, align 4
|
2018-12-21 16:12:15 -06:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test1(s: &mut S) {
|
|
|
|
s.arr[0] = 0;
|
|
|
|
s.arr[1] = 1;
|
|
|
|
s.arr[2] = 2;
|
|
|
|
s.arr[3] = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test2
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: store i32 4, {{i32\*|ptr}} %{{.+}}, align 4
|
2020-02-18 15:49:47 -06:00
|
|
|
#[allow(unconditional_panic)]
|
2018-12-21 16:12:15 -06:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test2(s: &mut S) {
|
|
|
|
s.arr[usize::MAX / 4 + 1] = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test3
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: store i32 5, {{i32\*|ptr}} %{{.+}}, align 4
|
2018-12-21 16:12:15 -06:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test3(s: &mut S, i: usize) {
|
|
|
|
s.arr[i] = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test4
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: store i32 6, {{i32\*|ptr}} %{{.+}}, align 4
|
2018-12-21 16:12:15 -06:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn test4(s: &mut S) {
|
|
|
|
s.arr = [6; 4];
|
|
|
|
}
|