aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/regression/Makefile2
-rw-r--r--test/regression/union_passing.c23
2 files changed, 24 insertions, 1 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile
index 0f9e368f..69d25980 100644
--- a/test/regression/Makefile
+++ b/test/regression/Makefile
@@ -18,7 +18,7 @@ TESTS?=int32 int64 floats floats-basics floats-lit \
funct3 expr5 struct7 struct8 struct11 struct12 casts1 casts2 char1 \
sizeof1 sizeof2 binops bool for1 for2 switch switch2 compound \
decl1 bitfields9 ptrs3 \
- parsing krfun ifconv many_parameters
+ parsing krfun ifconv many_parameters union_passing
# Can run, but only in compiled mode, and have reference output in Results
diff --git a/test/regression/union_passing.c b/test/regression/union_passing.c
new file mode 100644
index 00000000..b0ce6319
--- /dev/null
+++ b/test/regression/union_passing.c
@@ -0,0 +1,23 @@
+#include <stdint.h>
+#include <stdio.h>
+static int32_t bk;
+union ba {
+ int64_t bb;
+};
+static void dada(union ba);
+void nothing(void);
+void stuff(void) {
+ union ba f = {5};
+ int32_t i[1000];
+ nothing();
+ dada(f);
+}
+static void dada(union ba k) {
+ bk = k.bb;
+}
+void nothing(void) {
+}
+int main() {
+ stuff();
+ printf("result = %d\n", bk);
+}