diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /support/regression/tests/bug-2455.c | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'support/regression/tests/bug-2455.c')
| -rwxr-xr-x | support/regression/tests/bug-2455.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/support/regression/tests/bug-2455.c b/support/regression/tests/bug-2455.c new file mode 100755 index 0000000..c026543 --- /dev/null +++ b/support/regression/tests/bug-2455.c @@ -0,0 +1,55 @@ +/* + bug-2455.c +*/ + +#include <testfwk.h> + +#if !defined( __SDCC_pdk14) && !defined( __SDCC_pdk15) +typedef int (*funcType) (int); + +int foo0 (int a) +{ + return a + 2; +} + +int foo1 (int a) +{ + return a - 6; +} + +int foo2 (int a) +{ + return a * 2; +} + +struct +{ + funcType fpa[2]; + funcType fpb; +} testS = {{foo0, foo1}, foo2}; +#endif + +void testBug (void) +{ +#if !defined( __SDCC_pdk14) && !defined( __SDCC_pdk15) + ASSERT (testS.fpa[0] (5) == 7); + ASSERT (testS.fpa[1] (9) == 3); + ASSERT (testS.fpb (5) == 10); + + testS.fpa[0] = foo1; + testS.fpa[1] = foo2; + testS.fpb = foo0; + + ASSERT (testS.fpa[0] (5) == -1); + ASSERT (testS.fpa[1] (9) == 18); + ASSERT (testS.fpb (5) == 7); + + testS.fpb = testS.fpa[0]; + testS.fpa[0] = testS.fpa[1]; + testS.fpa[1] = foo0; + + ASSERT (testS.fpa[0] (5) == 10); + ASSERT (testS.fpa[1] (9) == 11); + ASSERT (testS.fpb (5) == -1); +#endif +} |
