aboutsummaryrefslogtreecommitdiffstats
path: root/test/regression/bitfields9.c
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2021-09-17 18:28:55 +0100
committerYann Herklotz <git@yannherklotz.com>2021-09-17 18:28:55 +0100
commita1c401a4eba5fc9fcf42933f70005ecb679a4c1c (patch)
tree26637fca5d1da9b3d049234721d593a60b03a6d3 /test/regression/bitfields9.c
parentc49caca4b5f0239b43610fbfe012d6ba0211b364 (diff)
parent1daf96cdca4d828c333cea5c9a314ef861342984 (diff)
downloadcompcert-a1c401a4eba5fc9fcf42933f70005ecb679a4c1c.tar.gz
compcert-a1c401a4eba5fc9fcf42933f70005ecb679a4c1c.zip
Merge branch 'master' into dev/michalisdev/michalis
Diffstat (limited to 'test/regression/bitfields9.c')
-rw-r--r--test/regression/bitfields9.c21
1 files changed, 8 insertions, 13 deletions
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;
}