From fc501ceff7fefc6ea2fdd956e2c769fcd11d9fdd Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sun, 14 Apr 2024 23:34:15 -0700 Subject: decl: Save and re-open parameter scope for body --- test/func-param-scope.c | 9 +++++++++ test/func-param-scope.qbe | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/func-param-scope.c create mode 100644 test/func-param-scope.qbe (limited to 'test') 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 +} -- cgit v1.2.3