aboutsummaryrefslogtreecommitdiff
path: root/test/builtin-vaarg-vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/builtin-vaarg-vm.c')
-rw-r--r--test/builtin-vaarg-vm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/builtin-vaarg-vm.c b/test/builtin-vaarg-vm.c
new file mode 100644
index 0000000..aee7216
--- /dev/null
+++ b/test/builtin-vaarg-vm.c
@@ -0,0 +1,16 @@
+int f(int i, ...) {
+ int r, c = 0;
+ __builtin_va_list ap;
+
+ __builtin_va_start(ap, i);
+ r = **__builtin_va_arg(ap, int (*)[++i]);
+ __builtin_va_end(ap);
+ return r + i;
+}
+
+int main(void) {
+ int a[3];
+
+ a[0] = 123;
+ return f(3, &a) != 127;
+}