about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-05-07 17:58:53 +0200
committerGitHub <noreply@github.com>2020-05-07 17:58:53 +0200
commit480f7181589192bf52a15e8bbbb684c6a485fa2c (patch)
tree68b3ec1bf5c4bfd403fb0efa599ff28641a976dd /src/test/codegen
parent037ae4008f3be22f48d40da7325f7af2ae1ccd1e (diff)
parentd717e55f19bb508279ce65ade826fd66be13a6e3 (diff)
downloadrust-480f7181589192bf52a15e8bbbb684c6a485fa2c.tar.gz
rust-480f7181589192bf52a15e8bbbb684c6a485fa2c.zip
Rollup merge of #71952 - JohnTitor:add-tests, r=Dylan-DPC
Add some regression tests

Closes #29988
Closes #34979
Pick up two snippets that have been fixed from #67945 (shouldn't be closed yet!)
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/ffi-out-of-bounds-loads.rs25
1 files changed, 25 insertions, 0 deletions
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..139a06ab53d
--- /dev/null
+++ b/src/test/codegen/ffi-out-of-bounds-loads.rs
@@ -0,0 +1,25 @@
+// Regression test for #29988
+
+// compile-flags: -C no-prepopulate-passes
+// only-x86_64
+// ignore-windows
+
+#[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);
+    }
+}