PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / va-arg-trap-1.c
blob1e1dae8e8aaa9e6112005f832650e755efb587ef
1 /* Undefined behavior from a call to va_arg with a type other than
2 that of the argument passed (in particular, with a type such as
3 "float" that can never be the type of an argument passed through
4 "...") does not appear until after the va_list expression is
5 evaluated. PR 38483. */
6 /* Origin: Joseph Myers <joseph@codesourcery.com> */
8 #include <stdarg.h>
10 extern void exit (int);
11 extern void abort (void);
13 va_list ap;
14 float f;
16 va_list *
17 foo (void)
19 exit (0);
20 return &ap;
23 void
24 bar (int i, ...)
26 va_start (ap, i);
27 f = va_arg (*foo (), float);
28 va_end (ap);
31 int
32 main (void)
34 bar (1, 0);
35 abort ();