about summary refs log tree commit diff
path: root/example
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-06-28 14:31:32 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-06-28 14:32:31 +0000
commit45b6cd6a8a2a3b364d22d4fabc0d72f9e37e3e50 (patch)
tree8eb8a2815490bf10493c54966cc28f77ca22359b /example
parentc1ac2df0c39ed12a4f4590319fb7b8045a5db5e5 (diff)
downloadrust-45b6cd6a8a2a3b364d22d4fabc0d72f9e37e3e50.tar.gz
rust-45b6cd6a8a2a3b364d22d4fabc0d72f9e37e3e50.zip
Fix a crash for 11 single byte fields passed through the C abi
Fixes #1234
Diffstat (limited to 'example')
-rw-r--r--example/mini_core_hello_world.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs
index 0f1245c2758..6111e035282 100644
--- a/example/mini_core_hello_world.rs
+++ b/example/mini_core_hello_world.rs
@@ -124,6 +124,23 @@ fn call_return_u128_pair() {
     return_u128_pair();
 }
 
+#[repr(C)]
+pub struct bool_11 {
+    field0: bool,
+    field1: bool,
+    field2: bool,
+    field3: bool,
+    field4: bool,
+    field5: bool,
+    field6: bool,
+    field7: bool,
+    field8: bool,
+    field9: bool,
+    field10: bool,
+}
+
+extern "C" fn bool_struct_in_11(arg0: bool_11) {}
+
 #[allow(unreachable_code)] // FIXME false positive
 fn main() {
     take_unique(Unique {
@@ -134,6 +151,20 @@ fn main() {
 
     call_return_u128_pair();
 
+    bool_struct_in_11(bool_11 {
+        field0: true,
+        field1: true,
+        field2: true,
+        field3: true,
+        field4: true,
+        field5: true,
+        field6: true,
+        field7: true,
+        field8: true,
+        field9: true,
+        field10: true,
+    });
+
     let slice = &[0, 1] as &[i32];
     let slice_ptr = slice as *const [i32] as *const i32;