1 /** bug-3778.c: Incorrect top byte on 24-bit function pointers
8 #if defined(__SDCC_stm8) && defined(__SDCC_MODEL_LARGE) // Fill lower 32KB of flash, so f1 or f2 is above 0x10000.
9 #define ARRAYSIZE 32000
16 j
= (j
+ 1) % (j
- 1);
18 j
= (j
- 1) % (j
+ 1);
20 j
= (j
+ 1) % (j
+ 1);
22 j
= (j
- 1) % (j
- 1);
24 j
= (j
+ 2) % (j
- 2);
26 j
= (j
- 2) % (j
+ 2);
33 const char c
[ARRAYSIZE
];
35 void f1(char c
, int i
) __reentrant
40 void g1(void(*ptr
)(char, int) __reentrant
)
42 (*ptr
)(1, 2); // Topmost byte of ptr incorrectly assumed to be 0.
50 void f2(char c
, int i
) __reentrant
55 void g2(void(*ptr
)(char, int) __reentrant
)
57 (*ptr
)(2, 3); // Topmost byte of ptr incorrectly assumed to be 0.