summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2752.c
blob: dd5acf3e48ffe6261d0a85331955b44e9bfcc0aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
   bug-2752.c
   A bug in inlining of reentrant functions into nonreentrant functions in the mcs51 backend.
 */

#include <testfwk.h>

#include <stdint.h>

inline uint8_t test(uintptr_t addr) __reentrant
{
        return *(volatile uint8_t __xdata *)(addr);
}

__xdata uint8_t dat1;
uint8_t dat2;

void call(void) /* Unbalanced stack pointer in this function */
{
	dat2 = test((uintptr_t)(&dat1));
}
	
void testBug(void)
{
	dat1 = 0x5a;
	call();
	ASSERT (dat2 == 0x5a);
}