summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/regression/Makefile2
-rw-r--r--test/regression/Results/bitfields32
-rw-r--r--test/regression/bitfields3.c15
3 files changed, 18 insertions, 1 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile
index 9fcd82f..08e1f70 100644
--- a/test/regression/Makefile
+++ b/test/regression/Makefile
@@ -7,7 +7,7 @@ CCOMPFLAGS=-stdlib ../../runtime -dparse -dclight -dasm \
LIBS=$(LIBMATH)
# Can run and have reference output in Results
-TESTS=bitfields1 bitfields2 expr1 initializers volatile2 funct3 expr5
+TESTS=bitfields1 bitfields2 bitfields3 expr1 initializers volatile2 funct3 expr5
# Other tests: should compile to .s without errors (but expect warnings)
EXTRAS=commaprec expr2 expr3 expr4 extern1 funct2 funptr1 init1 \
diff --git a/test/regression/Results/bitfields3 b/test/regression/Results/bitfields3
new file mode 100644
index 0000000..4f90515
--- /dev/null
+++ b/test/regression/Results/bitfields3
@@ -0,0 +1,2 @@
+x = {a = 12345678}
+x = {a = deadbeef}
diff --git a/test/regression/bitfields3.c b/test/regression/bitfields3.c
new file mode 100644
index 0000000..de29f4d
--- /dev/null
+++ b/test/regression/bitfields3.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+struct s {
+ unsigned int a: 32;
+};
+
+struct s x = { 0x12345678 };
+
+int main()
+{
+ printf("x = {a = %x}\n", x.a);
+ x.a = 0xDEADBEEF;
+ printf("x = {a = %x}\n", x.a);
+ return 0;
+}