Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-3141.c
blobafd867c0d8c79c39320527c7a0cdafabe0ad4701
1 /* bug 3141
2 a bug in code generation for stm8 large memory model (24-bit function pointers),
3 when returning function pointers fromk a function with a single 16-bit parameter while optimizing for code size.
4 */
5 #include <testfwk.h>
7 #pragma opt_code_size
9 void f(void)
13 typedef void (*p) (void);
15 p g(int b)
17 return (b ? &f : (p)0);
20 void testBug(void)
22 ASSERT (g(0) == 0);
23 ASSERT (g(1) == &f);