2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / mips / va-arg-1.c
blob87c95f525fb83086debab003c764962d48a9dfe9
1 /* See PR 52154 for the xfail. */
2 /* { dg-do run { xfail { mips_eabi && { hard_float && ilp32 } } } } */
4 #include <stdarg.h>
6 extern void abort (void);
8 struct __attribute__((aligned(16))) empty {};
10 static void __attribute__((noinline))
11 check_args (int count, ...)
13 va_list va;
14 int i;
16 va_start (va, count);
17 for (i = 0; i < count; i++)
18 if (va_arg (va, int) != 1000 + i)
19 abort ();
21 va_arg (va, struct empty);
22 if (va_arg (va, int) != 2000 + count)
23 abort ();
25 va_end (va);
28 int
29 main (void)
31 struct empty e;
33 check_args (1, 1000, e, 2001);
34 check_args (2, 1000, 1001, e, 2002);
35 check_args (3, 1000, 1001, 1002, e, 2003);
36 check_args (4, 1000, 1001, 1002, 1003, e, 2004);
37 check_args (5, 1000, 1001, 1002, 1003, 1004, e, 2005);
38 check_args (6, 1000, 1001, 1002, 1003, 1004, 1005, e, 2006);
39 check_args (7, 1000, 1001, 1002, 1003, 1004, 1005, 1006, e, 2007);
40 check_args (8, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, e, 2008);
41 check_args (9, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007,
42 1008, e, 2009);
43 check_args (10, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007,
44 1008, 1009, e, 2010);
45 check_args (11, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007,
46 1008, 1009, 1010, e, 2011);
47 return 0;