From: Yuki Okushi Date: Wed, 6 May 2020 17:13:20 +0000 (+0900) Subject: Add test for #29988 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=96d4e0bab23e1c0874af07cf0afcf3cec7e1cd0f;hp=339f574809bf8e4166b8de3cdbe7df181d37af3d;p=rust.git Add test for #29988 --- diff --git a/src/test/codegen/ffi-out-of-bounds-loads.rs b/src/test/codegen/ffi-out-of-bounds-loads.rs new file mode 100644 index 00000000000..a58d75389f5 --- /dev/null +++ b/src/test/codegen/ffi-out-of-bounds-loads.rs @@ -0,0 +1,22 @@ +// compile-flags: -C no-prepopulate-passes +// Regression test for #29988 + +#[repr(C)] +struct S { + f1: i32, + f2: i32, + f3: i32, +} + +extern { + fn foo(s: S); +} + +fn main() { + let s = S { f1: 1, f2: 2, f3: 3 }; + unsafe { + // CHECK: load { i64, i32 }, { i64, i32 }* {{.*}}, align 4 + // CHECK: call void @foo({ i64, i32 } {{.*}}) + foo(s); + } +}