From 4f206ac1ea1b20400fa242f2f3be86237c4ba3bf Mon Sep 17 00:00:00 2001 From: Nihal Jere Date: Sat, 27 Apr 2024 14:47:15 -0700 Subject: Implement variable length arrays Variably modified types are required for C23. Since QBE doesn't currently support saving and restoring the stack pointer, a current limitation is that we can't reclaim stack space from VLAs that go out of scope. This is potentially problematic for VLAs appearing in a loop, but this case is uncommon enough that it is silently ignored for now. Implements: https://todo.sr.ht/~mcf/cproc/1 References: https://todo.sr.ht/~mcf/cproc/88 Co-authored-by: Michael Forney --- test/vla-deref.c | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 test/vla-deref.c (limited to 'test/vla-deref.c') diff --git a/test/vla-deref.c b/test/vla-deref.c new file mode 100644 index 0000000..7a5cd20 --- /dev/null +++ b/test/vla-deref.c @@ -0,0 +1,4 @@ +int main(void) { + int l = 3; + char a[*&l]; +} -- cgit v1.2.3