Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-3043.c.in
blob0586af6d7633162d239014f21878305d9dcd93f0
1 /* bug 3048
2 stm8 and pdk code generator hang on shift by negative literal
3 type: char, signed char, unsigned char, signed int, unsigned int, signed long, unsigned long, signed long long, unsigned long long
4 */
5 #include <testfwk.h>
7 #pragma disable_warning 259
9 void g(void)
13 void fr({type} x)
15 if (((x >> -1))) // Undefined behaviour, but we should be fine if this is never executed at runtime.
16 g();
19 void fl({type} x)
21 if (((x << -1))) // Undefined behaviour, but we should be fine if this is never executed at runtime.
22 g();
25 void testBug(void)
27 volatile _Bool b = 0;
28 {type} i = 0x5a;
29 if (b)
30 fr(i);
31 if (b)
32 fl(i);