Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-2124.c
blobb229aabcac4ec96d1726f8f8a8638a445f9b51ee
1 /*
2 bug-2124.c
3 */
5 #include <testfwk.h>
7 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // pdk needs function pointer to be reentrant even for a single argument
8 typedef int (*DT)(int);
10 unsigned int f1(unsigned int c)
12 return c + 1;
15 int f2(int c)
17 return c + 2;
20 DT gpfunc[] = {(DT) f1, f2};
21 #endif
23 void testBug (void)
25 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15)
26 DT lpfunc[] = {(DT) f1, f2};
27 DT spfunc[] = {f2, (DT) f1};
29 ASSERT (gpfunc[0](0x55) == 0x56);
30 ASSERT (gpfunc[1](0x66) == 0x68);
31 ASSERT (lpfunc[0](0x77) == 0x78);
32 ASSERT (lpfunc[1](0x44) == 0x46);
33 ASSERT (spfunc[0](0x11) == 0x13);
34 ASSERT (spfunc[1](0x22) == 0x23);
35 #endif