struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2752.c
blobfef559e0e59bc389ca18fb14cb0e02782fa2c520
1 /*
2 bug-2752.c
3 A bug in inlining of reentrant functions into nonreentrant functions in the mcs51 backend.
4 */
6 #include <testfwk.h>
8 #include <stdint.h>
10 inline uint8_t test(uintptr_t addr) __reentrant
12 return *(volatile uint8_t __xdata *)(addr);
15 __xdata uint8_t dat1;
16 uint8_t dat2;
18 void call(void) /* Unbalanced stack pointer in this function */
20 dat2 = test((uintptr_t)(&dat1));
23 void testBug(void)
25 dat1 = 0x5a;
26 call();
27 ASSERT (dat2 == 0x5a);
30 extern uint8_t test(uintptr_t addr) __reentrant;