aboutsummaryrefslogtreecommitdiffstats
path: root/test/regression
diff options
context:
space:
mode:
authorDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-09-24 14:51:15 +0200
committerDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-09-24 14:51:15 +0200
commite49318b3606d7568d8592887e4278efa696afd10 (patch)
tree99a9a1b883e1db3a4f56e1b5046453817827ceef /test/regression
parent2789e6179af061381f5b18a268adb562b28bcb8e (diff)
parentc34d25e011402aedad62b3fe9b7b04989df4522e (diff)
downloadcompcert-kvx-e49318b3606d7568d8592887e4278efa696afd10.tar.gz
compcert-kvx-e49318b3606d7568d8592887e4278efa696afd10.zip
Merge branch 'master' of https://github.com/AbsInt/CompCert into towards_3.10
Diffstat (limited to 'test/regression')
-rw-r--r--test/regression/Makefile2
-rw-r--r--test/regression/Results/bitfields1014
-rw-r--r--test/regression/Results/bitfields918
-rwxr-xr-xtest/regression/Runtest2
-rw-r--r--test/regression/bitfields10.c66
-rw-r--r--test/regression/bitfields9.c21
-rw-r--r--test/regression/sizeof1.c4
7 files changed, 96 insertions, 31 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile
index 0f9e368f..db0b381e 100644
--- a/test/regression/Makefile
+++ b/test/regression/Makefile
@@ -23,7 +23,7 @@ TESTS?=int32 int64 floats floats-basics floats-lit \
# Can run, but only in compiled mode, and have reference output in Results
TESTS_COMP?=attribs1 bitfields1 bitfields2 bitfields3 bitfields4 \
- bitfields5 bitfields6 bitfields7 bitfields8 bitfields_uint_t \
+ bitfields5 bitfields6 bitfields7 bitfields8 bitfields_uint_t bitfields10 \
builtins-common builtins-$(ARCH) packedstruct1 packedstruct2 alignas \
varargs1 varargs2 varargs3 sections alias aligned
diff --git a/test/regression/Results/bitfields10 b/test/regression/Results/bitfields10
new file mode 100644
index 00000000..9dc00daf
--- /dev/null
+++ b/test/regression/Results/bitfields10
@@ -0,0 +1,14 @@
+loc_s = { a = 11, b = 2 }
+loc_t = { c = 11, d = 1, e = 2 }
+loc_u_u = { u = -5 }
+loc_u_v = { v = 3 }
+compound_s = { a = 2, b = 3 }
+compound_t = { c = 2, d = 1, e = -11 }
+compound_u = { u = 2 }
+loc_s = { a = 7, b = 2 }
+loc_t = { c = 7, d = 1, e = 50 }
+loc_u_u = { u = 7 }
+loc_u_v = { v = 2 }
+compound_s = { a = -14, b = 3 }
+compound_t = { c = 50, d = 1, e = -7 }
+compound_u = { u = 2 }
diff --git a/test/regression/Results/bitfields9 b/test/regression/Results/bitfields9
index e35c2414..ec35fc08 100644
--- a/test/regression/Results/bitfields9
+++ b/test/regression/Results/bitfields9
@@ -2,17 +2,7 @@ glob_s = { a = -12, b = 1 }
glob_t = { c = 123, d = 1, e = -45 }
glob_u_u = { u = -3 }
glob_u_v = { v = 6 }
-loc_s = { a = 11, b = 2 }
-loc_t = { c = 11, d = 1, e = 2 }
-loc_u_u = { u = -5 }
-loc_u_v = { v = 3 }
-compound_s = { a = 2, b = 3 }
-compound_t = { c = 2, d = 1, e = -11 }
-compound_u = { u = 2 }
-loc_s = { a = 7, b = 2 }
-loc_t = { c = 7, d = 1, e = 50 }
-loc_u_u = { u = 7 }
-loc_u_v = { v = 2 }
-compound_s = { a = -14, b = 3 }
-compound_t = { c = 50, d = 1, e = -7 }
-compound_u = { u = 2 }
+loc_s = { a = -12, b = 1 }
+loc_t = { c = 123, d = 1, e = -45 }
+loc_u_u = { u = -3 }
+loc_u_v = { v = 6 }
diff --git a/test/regression/Runtest b/test/regression/Runtest
index f693219a..600ae045 100755
--- a/test/regression/Runtest
+++ b/test/regression/Runtest
@@ -51,7 +51,7 @@ then
exit 0
else
echo "$name: WRONG OUTPUT (diff follows)"
- diff -u "$ref" "$out"
+ diff -a -u "$ref" "$out"
exit 2
fi
else
diff --git a/test/regression/bitfields10.c b/test/regression/bitfields10.c
new file mode 100644
index 00000000..0f022664
--- /dev/null
+++ b/test/regression/bitfields10.c
@@ -0,0 +1,66 @@
+#include <stdio.h>
+
+/* Dynamic initialization of bit-fields */
+/* Known not to work with the reference interpreter */
+
+struct s {
+ signed char a: 6;
+ unsigned int b: 2;
+};
+
+struct t {
+ unsigned int c: 16;
+ _Bool d: 1;
+ short e: 8;
+ int : 10;
+};
+
+union u {
+ int u: 4;
+ unsigned int v: 3;
+};
+
+void print_s(char * msg, struct s p)
+{
+ printf("%s = { a = %d, b = %d }\n", msg, p.a, p.b);
+}
+
+void print_t(char * msg, struct t p)
+{
+ printf("%s = { c = %d, d = %d, e = %d }\n", msg, p.c, p.d, p.e);
+}
+
+void print_u_u(char * msg, union u p)
+{
+ printf("%s = { u = %d }\n", msg, p.u);
+}
+
+void print_u_v(char * msg, union u p)
+{
+ printf("%s = { v = %u }\n", msg, p.v);
+}
+
+/* Local, non-static initialization */
+void f(int x, int y, int z)
+{
+ struct s loc_s = { x, y };
+ struct t loc_t = { x, z, y };
+ union u loc_u_u = { .u = x };
+ union u loc_u_v = { .v = z };
+ print_s("loc_s", loc_s);
+ print_t("loc_t", loc_t);
+ print_u_u("loc_u_u", loc_u_u);
+ print_u_v("loc_u_v", loc_u_v);
+ print_s("compound_s", (struct s) { y, x });
+ print_t("compound_t", (struct t) { y, ~z, -x });
+ print_u_u("compound_u", (union u) { y });
+}
+
+int main()
+{
+ f(11, 2, 3);
+ f(7, 50, 2);
+ return 0;
+}
+
+
diff --git a/test/regression/bitfields9.c b/test/regression/bitfields9.c
index eef20168..025216fa 100644
--- a/test/regression/bitfields9.c
+++ b/test/regression/bitfields9.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-/* Initialization of bit-fields */
+/* Static initialization of bit-fields */
struct s {
signed char a: 6;
@@ -39,27 +39,23 @@ void print_u_v(char * msg, union u p)
printf("%s = { v = %u }\n", msg, p.v);
}
-
/* Global initialization */
struct s glob_s = { -12, 1 };
struct t glob_t = { 123, 2, -45 };
union u glob_u_u = { -3 };
union u glob_u_v = { .v = 6 };
-/* Local initialization */
-void f(int x, int y, int z)
+/* Local, static initialization */
+void f(void)
{
- struct s loc_s = { x, y };
- struct t loc_t = { x, z, y };
- union u loc_u_u = { .u = x };
- union u loc_u_v = { .v = z };
+ static struct s loc_s = { -12, 1 };
+ static struct t loc_t = { 123, 2, -45 };
+ static union u loc_u_u = { -3 };
+ static union u loc_u_v = { .v = 6 };
print_s("loc_s", loc_s);
print_t("loc_t", loc_t);
print_u_u("loc_u_u", loc_u_u);
print_u_v("loc_u_v", loc_u_v);
- print_s("compound_s", (struct s) { y, x });
- print_t("compound_t", (struct t) { y, ~z, -x });
- print_u_u("compound_u", (union u) { y });
}
int main()
@@ -68,8 +64,7 @@ int main()
print_t("glob_t", glob_t);
print_u_u("glob_u_u", glob_u_u);
print_u_v("glob_u_v", glob_u_v);
- f(11, 2, 3);
- f(7, 50, 2);
+ f();
return 0;
}
diff --git a/test/regression/sizeof1.c b/test/regression/sizeof1.c
index ca494622..5bd4d739 100644
--- a/test/regression/sizeof1.c
+++ b/test/regression/sizeof1.c
@@ -17,8 +17,8 @@ char tbl[sizeof(struct s)];
*/
struct bits1 {
- unsigned a: 1;
- unsigned b: 6;
+ unsigned char a: 1;
+ unsigned char b: 6;
};
char b1[sizeof(struct bits1)]; /* should be 1 */