summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-12-20 13:13:29 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-12-20 13:13:29 +0000
commit1c768ee3ff91e826f52cf08e1aaa8c4d637240f5 (patch)
tree2e3b505567304d8795b06ff9b2485e230214d923 /test
parent7698300cfe2d3f944ce2e1d4a60a263620487718 (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/regression/Results/struct83
-rw-r--r--test/regression/struct8.c17
2 files changed, 20 insertions, 0 deletions
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;
}