From 1c768ee3ff91e826f52cf08e1aaa8c4d637240f5 Mon Sep 17 00:00:00 2001 From: xleroy Date: Fri, 20 Dec 2013 13:13:29 +0000 Subject: Hack StructReturn to better adhere to PowerPC and ARM calling conventions. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2382 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- test/regression/Results/struct8 | 3 +++ test/regression/struct8.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'test') diff --git a/test/regression/Results/struct8 b/test/regression/Results/struct8 index 19ec15d..ed5690b 100644 --- a/test/regression/Results/struct8 +++ b/test/regression/Results/struct8 @@ -3,3 +3,6 @@ b = { 125, 5.436000, 'f' } c = { 128, 16.308000, 'f' } d = { 125, 5.436000, 'f' } e = { 128, 16.308000, 'f' } +x = { 'x', 'y' } +y = { 'y', 'x' } +z = { 'x', 'y' } diff --git a/test/regression/struct8.c b/test/regression/struct8.c index a100cbe..00a3f7c 100644 --- a/test/regression/struct8.c +++ b/test/regression/struct8.c @@ -13,17 +13,34 @@ struct S f(struct S s, int scale) return r; } +struct T { char a, b; }; + +struct T g(struct T s) +{ + struct T r; + r.a = s.b; + r.b = s.a; + return r; +} + int main() { struct S a = { 123, 2.718, 'a' }; struct S b, c, d, e; + struct T x = { 'x', 'y' }; + struct T y, z; b = f(a, 2); c = f(f(a, 2), 3); e = f((d = f(a, 2)), 3); + y = g(x); + z = g(g(x)); printf("a = { %d, %f, '%c' }\n", a.x, a.d, a.c); printf("b = { %d, %f, '%c' }\n", b.x, b.d, b.c); printf("c = { %d, %f, '%c' }\n", c.x, c.d, c.c); printf("d = { %d, %f, '%c' }\n", d.x, d.d, d.c); printf("e = { %d, %f, '%c' }\n", e.x, e.d, e.c); + printf("x = { '%c', '%c' }\n", x.a, x.b); + printf("y = { '%c', '%c' }\n", y.a, y.b); + printf("z = { '%c', '%c' }\n", z.a, z.b); return 0; } -- cgit v1.2.3