PR c/64856
[official-gcc.git] / gcc / testsuite / gcc.dg / builtin-apply2.c
blobb6cbe39f4db6e804db9768de51942804279e9fc5
1 /* { dg-do run } */
2 /* { dg-require-effective-target untyped_assembly } */
3 /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "avr-*-* nds32*-*-*" } { "*" } { "" } } */
4 /* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { arm*-*-* && arm_hf_eabi } { "*" } { "" } } */
6 /* PR target/12503 */
7 /* Origin: <pierre.nguyen-tuong@asim.lip6.fr> */
9 /* Verify that __builtin_apply behaves correctly on targets
10 with pre-pushed arguments (e.g. SPARC). */
14 #define INTEGER_ARG 5
16 #if defined(__ARM_PCS) || defined(__epiphany__)
17 /* For Base AAPCS, NAME is passed in r0. D is passed in r2 and r3.
18 E, F and G are passed on stack. So the size of the stack argument
19 data is 20. */
20 #define STACK_ARGUMENTS_SIZE 20
21 #elif defined __MMIX__ || defined __arc__
22 /* No parameters on stack for bar. */
23 #define STACK_ARGUMENTS_SIZE 0
24 #else
25 #define STACK_ARGUMENTS_SIZE 64
26 #endif
28 extern void abort(void);
30 void foo(char *name, double d, double e, double f, int g)
32 if (g != INTEGER_ARG)
33 abort();
36 void bar(char *name, ...)
38 __builtin_apply(foo, __builtin_apply_args(), STACK_ARGUMENTS_SIZE);
41 int main(void)
43 bar("eeee", 5.444567, 8.90765, 4.567789, INTEGER_ARG);
45 return 0;