111
|
1 /* { dg-do run } */
|
|
2 /* { dg-require-effective-target untyped_assembly } */
|
145
|
3 /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "avr-*-* nds32*-*-* amdgcn-*-*" } } */
|
|
4 /* { dg-skip-if "Variadic funcs use different argument passing from normal funcs." { "riscv*-*-* or1k*-*-* msp430-*-* pru-*-*" } } */
|
111
|
5 /* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { arm*-*-* && arm_hf_eabi } } */
|
|
6
|
|
7 /* PR target/12503 */
|
|
8 /* Origin: <pierre.nguyen-tuong@asim.lip6.fr> */
|
|
9
|
|
10 /* Verify that __builtin_apply behaves correctly on targets
|
|
11 with pre-pushed arguments (e.g. SPARC). */
|
|
12
|
|
13
|
|
14
|
|
15 #define INTEGER_ARG 5
|
|
16
|
|
17 #if defined(__ARM_PCS) || defined(__epiphany__)
|
|
18 /* For Base AAPCS, NAME is passed in r0. D is passed in r2 and r3.
|
|
19 E, F and G are passed on stack. So the size of the stack argument
|
|
20 data is 20. */
|
|
21 #define STACK_ARGUMENTS_SIZE 20
|
|
22 #elif defined __MMIX__ || defined __arc__
|
|
23 /* No parameters on stack for bar. */
|
|
24 #define STACK_ARGUMENTS_SIZE 0
|
|
25 #else
|
|
26 #define STACK_ARGUMENTS_SIZE 64
|
|
27 #endif
|
|
28
|
|
29 extern void abort(void);
|
|
30
|
|
31 void foo(char *name, double d, double e, double f, int g)
|
|
32 {
|
|
33 if (g != INTEGER_ARG)
|
|
34 abort();
|
|
35 }
|
|
36
|
|
37 void bar(char *name, ...)
|
|
38 {
|
|
39 __builtin_apply(foo, __builtin_apply_args(), STACK_ARGUMENTS_SIZE);
|
|
40 }
|
|
41
|
|
42 int main(void)
|
|
43 {
|
|
44 bar("eeee", 5.444567, 8.90765, 4.567789, INTEGER_ARG);
|
|
45
|
|
46 return 0;
|
|
47 }
|