about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorSimonas Kazlauskas <git@kazlauskas.me>2018-07-26 17:55:25 +0300
committerSimonas Kazlauskas <git@kazlauskas.me>2018-07-26 17:55:25 +0300
commitcc2bd71269f9c54fed3849141e29204a5f353693 (patch)
treef329222930bbd1d41ec58be4b35cc96f39afe171 /src/test/codegen
parent051eddd9a9067dcbdccef6bfd86301453bae42ad (diff)
downloadrust-cc2bd71269f9c54fed3849141e29204a5f353693.tar.gz
rust-cc2bd71269f9c54fed3849141e29204a5f353693.zip
Add a test for sparc64 ABI issue
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/sparc-struct-abi.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/codegen/sparc-struct-abi.rs b/src/test/codegen/sparc-struct-abi.rs
new file mode 100644
index 00000000000..d3b7a5cd598
--- /dev/null
+++ b/src/test/codegen/sparc-struct-abi.rs
@@ -0,0 +1,36 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// Checks that we correctly codegen extern "C" functions returning structs.
+// See issue #52638.
+
+// compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib
+#![feature(no_core, lang_items)]
+#![no_core]
+
+#[lang="sized"]
+trait Sized { }
+#[lang="freeze"]
+trait Freeze { }
+#[lang="copy"]
+trait Copy { }
+
+#[repr(C)]
+pub struct Bool {
+    b: bool,
+}
+
+// CHECK: define i64 @structbool()
+// CHECK-NEXT: start:
+// CHECK-NEXT: ret i64 72057594037927936
+#[no_mangle]
+pub extern "C" fn structbool() -> Bool {
+    Bool { b: true }
+}