OSDN Git Service

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