blob: 4b3a2672c167e5d4650a2f00119d695b52a0040d (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/** test callee_saves function calling caller_saves
see bug 1928
*/
#include <testfwk.h>
#if defined (__mcs51) && !defined (SDCC_MODEL_HUGE)
int x(int a, int b)
{
return a - b;
}
#pragma callee_saves y
int y(int a, int b)
{
int c = a + b;
x(a, b);
return c;
}
#pragma callee_saves z
void z(void)
{
x(1, 2);
}
int g = 100;
#endif
void testBug(void)
{
#if defined (__mcs51) && !defined (SDCC_MODEL_HUGE)
int a = g;
ASSERT (y(1, 2) == 3);
ASSERT (a == 100);
a = g;
z();
ASSERT (a == 100);
#endif
}
|