| 1 |
/* __builtin_ms_va_list is only supported for -m64. */ |
| 2 |
/* { dg-do run { target lp64 } } */ |
| 3 |
/* { dg-require-effective-target lto } */ |
| 4 |
/* { dg-options "-flto" } */ |
| 5 |
|
| 6 |
#include <stdio.h> |
| 7 |
|
| 8 |
int __attribute__((ms_abi)) |
| 9 |
foo (int n, ...) |
| 10 |
{ |
| 11 |
__builtin_ms_va_list ap; |
| 12 |
int sum = 0; |
| 13 |
|
| 14 |
__builtin_ms_va_start (ap, n); |
| 15 |
|
| 16 |
while (n--) |
| 17 |
{ |
| 18 |
sum += __builtin_va_arg (ap, int); |
| 19 |
printf ("sum = %d\n", sum); |
| 20 |
} |
| 21 |
|
| 22 |
__builtin_ms_va_end (ap); |
| 23 |
|
| 24 |
return sum; |
| 25 |
} |
| 26 |
|
| 27 |
int |
| 28 |
main (void) |
| 29 |
{ |
| 30 |
int res = foo (10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
| 31 |
|
| 32 |
if (res != 55) |
| 33 |
__builtin_abort (); |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |