From: Ulrich Drepper Date: Mon, 4 Oct 1999 22:12:37 +0000 (+0000) Subject: Test for not using results of va_arg calls. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ed9e042da2a9a6508471d601080153c7e6ca8b83;p=gcc.git Test for not using results of va_arg calls. From-SVN: r29814 --- 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 00000000000..349c125ed50 --- /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 + +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; +}