1 /* Copyright (C) 2000 Free Software Foundation.
3 If the argument to va_end() has side effects, test whether side
4 effects from that argument are honored.
6 Written by Kaveh R. Ghazi, 10/31/2000. */
13 #define __attribute__(x)
16 static void __attribute__ ((__format__ (__printf__, 1, 2)))
17 doit (const char *s, ...)
19 va_list *ap_array[3], **ap_ptr = ap_array;
21 ap_array[0] = malloc (sizeof(va_list));
23 ap_array[2] = malloc (sizeof(va_list));
25 va_start (*ap_array[0], s);
26 vprintf (s, **ap_ptr);
27 /* Increment the va_list pointer once. */
30 /* Increment the va_list pointer a second time. */
33 va_start (*ap_array[2], s);
34 /* If we failed to increment ap_ptr twice, then the parameter passed
35 in here will dereference NULL and should cause a crash. */
36 vprintf (s, **ap_ptr);
39 /* Just in case, If *ap_ptr is NULL abort anyway. */
46 doit ("%s", "hello world\n");