aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/Regression/C/gcc-c-torture/execute/va-arg-11.c
diff options
context:
space:
mode:
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/va-arg-11.c')
-rw-r--r--SingleSource/Regression/C/gcc-c-torture/execute/va-arg-11.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/va-arg-11.c b/SingleSource/Regression/C/gcc-c-torture/execute/va-arg-11.c
new file mode 100644
index 00000000..b178b880
--- /dev/null
+++ b/SingleSource/Regression/C/gcc-c-torture/execute/va-arg-11.c
@@ -0,0 +1,29 @@
+/* Test va_arg when the result is ignored and only the pointer increment
+ side effect is used. */
+#include <stdarg.h>
+
+static int
+foo (int a, ...)
+{
+ va_list va;
+ int i, res;
+
+ va_start (va, a);
+
+ for (i = 0; i < 4; ++i)
+ (void) va_arg (va, int);
+
+ res = va_arg (va, int);
+
+ va_end (va);
+
+ return res;
+}
+
+int
+main (void)
+{
+ if (foo (5, 4, 3, 2, 1, 0))
+ abort ();
+ exit (0);
+}