]> git.lizzy.rs Git - rust.git/commitdiff
Add test for #29988
authorYuki Okushi <huyuumi.dev@gmail.com>
Wed, 6 May 2020 17:13:20 +0000 (02:13 +0900)
committerYuki Okushi <huyuumi.dev@gmail.com>
Wed, 6 May 2020 17:22:08 +0000 (02:22 +0900)
src/test/codegen/ffi-out-of-bounds-loads.rs [new file with mode: 0644]

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 (file)
index 0000000..a58d753
--- /dev/null
@@ -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);
+    }
+}