aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-01-28 10:02:03 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2015-01-28 10:02:03 +0100
commit6f3ac9e1cef476ef0c5eaf7875af24543f66128a (patch)
tree35e29782b59ec91b0510d40edb9306cbc74fde8f /test
parente096fa7aa6161e1f5a74001185eb3873a684c48d (diff)
downloadcompcert-6f3ac9e1cef476ef0c5eaf7875af24543f66128a.tar.gz
compcert-6f3ac9e1cef476ef0c5eaf7875af24543f66128a.zip
More interoperability tests.
Diffstat (limited to 'test')
-rw-r--r--test/regression/Results/interop112
-rw-r--r--test/regression/interop1.c31
2 files changed, 34 insertions, 9 deletions
diff --git a/test/regression/Results/interop1 b/test/regression/Results/interop1
index 34ec8e6b..bac9aaab 100644
--- a/test/regression/Results/interop1
+++ b/test/regression/Results/interop1
@@ -20,7 +20,9 @@ u5 = { a = 123, b = 'z' }
u6 = { a = -12345678, b = 555 }
u7 = { a = 111111111, b = 2222, c = 'a' }
u8 = { a = 'u', b = 8 }
-u9 = { a = 3.14159, b = -2.718 }
+u9 = { a = { 9, 8, 7, 6 } }
+after ms4, x = { 's', 'a', 'm', 'e' }
+after mu9, x = { a = { 11, 22, 33, 44 } }
rs1 = { a = 'a' }
rs2 = { a = 'a', b = 'b' }
rs3 = { a = 'a', b = 'b', c = 'c' }
@@ -28,7 +30,7 @@ rs4 = { a = 'a', b = 'b', c = 'c', d = 'd' }
rs8 = { "Lorem ipsum" }
ru2 = { a = 12, b = -34 }
ru6 = { a = 12345678, b = -9999 }
-ru9 = { a = 0.123400, b = -5678.900000 }
+ru9 = { a = { 111, 222, 333, 444 } }
--- native calling CompCert:
s1 = { a = 'a' }
s2 = { a = 'x', b = 'y' }
@@ -51,7 +53,9 @@ u5 = { a = 123, b = 'z' }
u6 = { a = -12345678, b = 555 }
u7 = { a = 111111111, b = 2222, c = 'a' }
u8 = { a = 'u', b = 8 }
-u9 = { a = 3.14159, b = -2.718 }
+u9 = { a = { 9, 8, 7, 6 } }
+after ms4, x = { 's', 'a', 'm', 'e' }
+after mu9, x = { a = { 11, 22, 33, 44 } }
rs1 = { a = 'a' }
rs2 = { a = 'a', b = 'b' }
rs3 = { a = 'a', b = 'b', c = 'c' }
@@ -59,4 +63,4 @@ rs4 = { a = 'a', b = 'b', c = 'c', d = 'd' }
rs8 = { "Lorem ipsum" }
ru2 = { a = 12, b = -34 }
ru6 = { a = 12345678, b = -9999 }
-ru9 = { a = 0.123400, b = -5678.900000 }
+ru9 = { a = { 111, 222, 333, 444 } }
diff --git a/test/regression/interop1.c b/test/regression/interop1.c
index 325eb574..3f9093f8 100644
--- a/test/regression/interop1.c
+++ b/test/regression/interop1.c
@@ -37,7 +37,7 @@ struct U5 { int a; char b; };
struct U6 { int a; short b; };
struct U7 { int a; short b; char c; };
struct U8 { char a; int b; };
-struct U9 { double a, b; };
+struct U9 { int a[4]; };
/* Struct passing */
@@ -175,7 +175,22 @@ void US(u8) (struct U8 x)
extern void THEM(u9) (struct U9 x);
void US(u9) (struct U9 x)
{
- printf("u9 = { a = %g, b = %g }\n", x.a, x.b);
+ printf("u9 = { a = { %d, %d, %d, %d } }\n", x.a[0], x.a[1], x.a[2], x.a[3]);
+}
+
+/* Struct passing with modification in the callee */
+
+extern void THEM (ms4) (struct S4 x);
+void US (ms4) (struct S4 x)
+{
+ x.a += 1; x.d -= 1;
+}
+
+extern void THEM (mu9) (struct U9 x);
+void US (mu9) (struct U9 x)
+{
+ int i;
+ for (i = 0; i < 4; i++) x.a[i] = i;
}
/* Struct return */
@@ -210,7 +225,7 @@ struct U6 US(ru6) (void)
extern struct U9 THEM(ru9) (void);
struct U9 US(ru9) (void)
-{ return (struct U9){ 0.1234, -5678.9 }; }
+{ return (struct U9){ 111, 222, 333, 444 }; }
/* Test function, calling the functions compiled by the other compiler */
@@ -238,7 +253,13 @@ void US(test) (void)
THEM(u6)((struct U6) { -12345678, 555 });
THEM(u7)((struct U7) { 111111111, 2222, 'a' });
THEM(u8)((struct U8) { 'u', 8 });
- THEM(u9)((struct U9) { 3.14159, -2.718 });
+ THEM(u9)((struct U9) { 9, 8, 7, 6 });
+ { struct S4 x = { 's', 'a', 'm', 'e' };
+ THEM(ms4)(x);
+ printf("after ms4, x = { '%c', '%c', '%c', '%c' }\n", x.a, x.b, x.c, x.d); }
+ { struct U9 x = { 11, 22, 33, 44 };
+ THEM(mu9)(x);
+ printf("after mu9, x = { a = { %d, %d, %d, %d } }\n", x.a[0], x.a[1], x.a[2], x.a[3]); }
{ struct S1 x = THEM(rs1)();
printf("rs1 = { a = '%c' }\n", x.a); }
{ struct S2 x = THEM(rs2)();
@@ -255,7 +276,7 @@ void US(test) (void)
{ struct U6 x = THEM(ru6)();
printf("ru6 = { a = %d, b = %d }\n", x.a, x.b); }
{ struct U9 x = THEM(ru9)();
- printf("ru9 = { a = %f, b = %f }\n", x.a, x.b); }
+ printf("ru9 = { a = { %d, %d, %d, %d } }\n", x.a[0], x.a[1], x.a[2], x.a[3]); }
}
#if defined(COMPCERT_SIDE)