Skip to content

Commit cc2bd71

Browse files
committed
Add a test for sparc64 ABI issue
1 parent 051eddd commit cc2bd71

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/test/codegen/sparc-struct-abi.rs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
//
11+
// Checks that we correctly codegen extern "C" functions returning structs.
12+
// See issue #52638.
13+
14+
// compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib
15+
#![feature(no_core, lang_items)]
16+
#![no_core]
17+
18+
#[lang="sized"]
19+
trait Sized { }
20+
#[lang="freeze"]
21+
trait Freeze { }
22+
#[lang="copy"]
23+
trait Copy { }
24+
25+
#[repr(C)]
26+
pub struct Bool {
27+
b: bool,
28+
}
29+
30+
// CHECK: define i64 @structbool()
31+
// CHECK-NEXT: start:
32+
// CHECK-NEXT: ret i64 72057594037927936
33+
#[no_mangle]
34+
pub extern "C" fn structbool() -> Bool {
35+
Bool { b: true }
36+
}

0 commit comments

Comments
 (0)