aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/func-param-scope.c9
-rw-r--r--test/func-param-scope.qbe13
2 files changed, 22 insertions, 0 deletions
diff --git a/test/func-param-scope.c b/test/func-param-scope.c
new file mode 100644
index 0000000..f5e51f3
--- /dev/null
+++ b/test/func-param-scope.c
@@ -0,0 +1,9 @@
+enum {A = 1};
+char (*f(enum {A = 2} *p, int (*a)[A], double (*b)[sizeof **a]))[A] {
+ static_assert(A == 2);
+ static_assert(sizeof *b == sizeof(int) * sizeof(double));
+ static_assert(sizeof *a == 2 * sizeof(int));
+ return 0;
+}
+static_assert(A == 1);
+static_assert(sizeof *f(0, 0, 0) == 1);
diff --git a/test/func-param-scope.qbe b/test/func-param-scope.qbe
new file mode 100644
index 0000000..4272fc7
--- /dev/null
+++ b/test/func-param-scope.qbe
@@ -0,0 +1,13 @@
+export
+function l $f(l %.1, l %.3, l %.5) {
+@start.1
+ %.2 =l alloc8 8
+ storel %.1, %.2
+ %.4 =l alloc8 8
+ storel %.3, %.4
+ %.6 =l alloc8 8
+ storel %.5, %.6
+@body.2
+ %.7 =l extsw 0
+ ret %.7
+}