Skip to content

Commit 992c27c

Browse files
committed
Add test for nested structures.
1 parent 0d20011 commit 992c27c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

+20
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,23 @@ pub struct FloatLongFloat {
8181
pub extern "C" fn structfloatlongfloat() -> FloatLongFloat {
8282
FloatLongFloat { f: 0.1, i: 123, g: 3.14 }
8383
}
84+
85+
#[repr(C)]
86+
pub struct FloatFloat {
87+
f: f32,
88+
g: f32,
89+
}
90+
91+
#[repr(C)]
92+
pub struct NestedStructs {
93+
a: FloatFloat,
94+
b: FloatFloat,
95+
}
96+
97+
// CHECK: define inreg { float, float, float, float } @structnestestructs()
98+
// CHECK-NEXT: start:
99+
// CHECK-NEXT: ret { float, float, float, float } { float 0x3FB99999A0000000, float 0x3FF19999A0000000, float 0x40019999A0000000, float 0x400A666660000000 }
100+
#[no_mangle]
101+
pub extern "C" fn structnestestructs() -> NestedStructs {
102+
NestedStructs { a: FloatFloat { f: 0.1, g: 1.1 }, b: FloatFloat { f: 2.2, g: 3.3 } }
103+
}

0 commit comments

Comments
 (0)