OSDN Git Service

PR middle-end/52419
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtin-apply2.c
1 /* { dg-do run } */
2 /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "avr-*-*" } { "*" } { "" } } */
3 /* { dg-skip-if "Variadic funcs use Base AAPCS.  Normal funcs use VFP variant." { "arm*-*-*" } { "-mfloat-abi=hard" } { "" } } */
4
5 /* PR target/12503 */
6 /* Origin: <pierre.nguyen-tuong@asim.lip6.fr> */
7
8 /* Verify that __builtin_apply behaves correctly on targets
9    with pre-pushed arguments (e.g. SPARC).  */
10
11
12
13 #define INTEGER_ARG  5
14
15 #if defined(__ARM_PCS) || defined(__epiphany__)
16 /* For Base AAPCS, NAME is passed in r0.  D is passed in r2 and r3.
17    E, F and G are passed on stack.  So the size of the stack argument
18    data is 20.  */
19 #define STACK_ARGUMENTS_SIZE  20
20 #else
21 #define STACK_ARGUMENTS_SIZE  64
22 #endif
23
24 extern void abort(void);
25
26 void foo(char *name, double d, double e, double f, int g)
27 {
28   if (g != INTEGER_ARG)
29     abort();
30 }
31
32 void bar(char *name, ...)
33 {
34   __builtin_apply(foo, __builtin_apply_args(), STACK_ARGUMENTS_SIZE);
35 }
36
37 int main(void)
38 {
39   bar("eeee", 5.444567, 8.90765, 4.567789, INTEGER_ARG);
40
41   return 0;
42 }