gcc/testsuite/gcc.dg/union-2.c
raw| 1 | /* This used to segfault on SPARC 64-bit at runtime because |
| 2 | the stack pointer was clobbered by the function call. */ |
| 3 | |
| 4 | /* { dg-do run } */ |
| 5 | |
| 6 | #include <stdarg.h> |
| 7 | |
| 8 | union U |
| 9 | { |
| 10 | long l1[2]; |
| 11 | }; |
| 12 | |
| 13 | union U u; |
| 14 | |
| 15 | void foo (int z, ...) |
| 16 | { |
| 17 | int i; |
| 18 | va_list ap; |
| 19 | va_start(ap,z); |
| 20 | i = va_arg(ap, int); |
| 21 | va_end(ap); |
| 22 | } |
| 23 | |
| 24 | int main(void) |
| 25 | { |
| 26 | foo (1, 1, 1, 1, 1, u); |
| 27 | return 0; |
| 28 | } |