diff options
author | Ulrich Drepper <drepper@gcc.gnu.org> | 1999-10-04 22:12:37 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@gcc.gnu.org> | 1999-10-04 22:12:37 +0000 |
commit | ed9e042da2a9a6508471d601080153c7e6ca8b83 (patch) | |
tree | 3d033b7febf2b217f3aa918dd962d780e914bf26 /gcc/testsuite | |
parent | 5d836b57fc71abe4af7288d558b073baecab2157 (diff) | |
download | gcc-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.c | 29 |
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; +} |