summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/amd64-abi-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/amd64-abi-4.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/amd64-abi-4.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/amd64-abi-4.c b/gcc/testsuite/gcc.target/i386/amd64-abi-4.c
new file mode 100644
index 000000000..8f3202966
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amd64-abi-4.c
@@ -0,0 +1,47 @@
+/* { dg-do run } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -mno-sse" } */
+
+#include <stdarg.h>
+#include <assert.h>
+
+int n1 = 30;
+int n2 = 324;
+void *n3 = (void *) &n2;
+int n4 = 407;
+
+int e1;
+int e2;
+void *e3;
+int e4;
+
+static void
+__attribute__((noinline))
+foo (va_list va_arglist)
+{
+ e2 = va_arg (va_arglist, int);
+ e3 = va_arg (va_arglist, void *);
+ e4 = va_arg (va_arglist, int);
+}
+
+static void
+__attribute__((noinline))
+test (int a1, ...)
+{
+ e1 = a1;
+ va_list va_arglist;
+ va_start (va_arglist, a1);
+ foo (va_arglist);
+ va_end (va_arglist);
+}
+
+int
+main ()
+{
+ test (n1, n2, n3, n4);
+ assert (n1 == e1);
+ assert (n2 == e2);
+ assert (n3 == e3);
+ assert (n4 == e4);
+ return 0;
+}