aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gcc.gnu.org>1999-10-04 22:12:37 +0000
committerUlrich Drepper <drepper@gcc.gnu.org>1999-10-04 22:12:37 +0000
commited9e042da2a9a6508471d601080153c7e6ca8b83 (patch)
tree3d033b7febf2b217f3aa918dd962d780e914bf26 /gcc/testsuite
parent5d836b57fc71abe4af7288d558b073baecab2157 (diff)
downloadgcc-ed9e042da2a9a6508471d601080153c7e6ca8b83.zip
gcc-ed9e042da2a9a6508471d601080153c7e6ca8b83.tar.gz
gcc-ed9e042da2a9a6508471d601080153c7e6ca8b83.tar.bz2
Test for not using results of va_arg calls.
From-SVN: r29814
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/va-arg-11.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-11.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-11.c
new file mode 100644
index 0000000..349c125
--- /dev/null
+++ b/gcc/testsuite/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 ();
+ return 0;
+}