struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug2783061.c
blobfe87c950ec370c4cfec581a754d3df8b66b3f23c
1 /*
2 bug 2783061
3 */
5 #include <stdarg.h>
6 #include <testfwk.h>
8 #define CP (void __code*)0x1234
9 #define XP (void __xdata*)0x5678
11 void
12 varargs_fn (char k, ...)
14 va_list arg;
15 void __code * cp;
16 void __xdata * xp;
17 void * gp;
19 va_start (arg, k);
21 cp = va_arg (arg, void __code *);
22 ASSERT (cp == CP);
23 xp = va_arg (arg, void __xdata *);
24 ASSERT (xp == XP);
25 gp = va_arg (arg, void *);
26 ASSERT (gp == (void *)CP);
27 #if defined(__SDCC_hc08) || defined(__SDCC_s08)
28 /* bug 2713 - casting literal pointer to generic pointer modified upper bits */
29 ASSERT ((int)gp == 0x1234);
30 #endif
31 gp = va_arg (arg, void *);
32 ASSERT (gp == (void *)XP);
34 va_end (arg);
37 void
38 testBug (void)
40 void __code * cp = CP;
41 void __xdata * xp = XP;
43 varargs_fn('k', (void __code *)cp, (void __xdata *)xp, cp, xp);