aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-03-30 01:50:25 -0700
committerMichael Forney <mforney@mforney.org>2021-03-30 03:32:32 -0700
commit4b74d8aa68fca6692782a47277e1dade5a2b039e (patch)
tree1c22a5ce00650e0a6c1649d4bb5fc0fd66963f16 /test
parent041234b4702b3e3059d19c1c3b2fc6382e8b80f3 (diff)
downloadcproc-4b74d8aa68fca6692782a47277e1dade5a2b039e.tar.xz
Add struct passing call test
The struct-passing test checks for function definitions with struct arguments, but we were missing a test for function calls with struct arguments.
Diffstat (limited to 'test')
-rw-r--r--test/struct-passing-call.c8
-rw-r--r--test/struct-passing-call.qbe9
2 files changed, 17 insertions, 0 deletions
diff --git a/test/struct-passing-call.c b/test/struct-passing-call.c
new file mode 100644
index 0000000..2ad746e
--- /dev/null
+++ b/test/struct-passing-call.c
@@ -0,0 +1,8 @@
+struct s {
+ int x;
+} s;
+
+void f(struct s);
+void g(void) {
+ f(s);
+}
diff --git a/test/struct-passing-call.qbe b/test/struct-passing-call.qbe
new file mode 100644
index 0000000..1c5e623
--- /dev/null
+++ b/test/struct-passing-call.qbe
@@ -0,0 +1,9 @@
+type :s.1 = { w, }
+export
+function $g() {
+@start.1
+@body.2
+ call $f(:s.1 $s)
+ ret
+}
+export data $s = align 4 { z 4 }