struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-va-arg-5.c
blob3f17ee7a7efc793f7705c79ec23e5c5443d262d9
1 /*
2 va-arg-5.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #include <stdarg.h>
9 void
10 va_double (int n, ...)
12 va_list args;
14 va_start (args, n);
16 ASSERT(va_arg (args, double) == 3.141592);
17 ASSERT(va_arg (args, double) == 2.71827);
18 ASSERT(va_arg (args, double) == 2.2360679);
19 ASSERT(va_arg (args, double) == 2.1474836);
21 va_end (args);
23 #if 0 // TODO: Enable when SDCC supports long double!
24 void
25 va_long_double (int n, ...)
27 va_list args;
29 va_start (args, n);
31 ASSERT(va_arg (args, long double) == 3.141592L);
32 ASSERT(va_arg (args, long double) == 2.71827L);
33 ASSERT(va_arg (args, long double) == 2.2360679L);
34 ASSERT(va_arg (args, long double) == 2.1474836L);
36 va_end (args);
38 #endif
39 void
40 testTortureExecute (void)
42 #ifndef __SDCC_pdk14 // Lack of memory
43 #if !(defined (__GNUC__) && __GNUC__ < 12) // Test fails on older GCC on 32-bit systems
44 va_double (4, 3.141592, 2.71827, 2.2360679, 2.1474836);
45 #if 0
46 va_long_double (4, 3.141592L, 2.71827L, 2.2360679L, 2.1474836L);
47 #endif
48 return;
49 #endif
50 #endif