X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=support%2Fregression%2Ftests%2Fbug-460000.c;fp=support%2Fregression%2Ftests%2Fbug-460000.c;h=934ae4845e504e4213920ac25bca949fb66e9886;hb=faf36532f8fe1cff757958cb6a222c141f1eeaa4;hp=0000000000000000000000000000000000000000;hpb=69b1d117513dcf8f691af325e978c94b052838af;p=fw%2Fsdcc diff --git a/support/regression/tests/bug-460000.c b/support/regression/tests/bug-460000.c new file mode 100644 index 00000000..934ae484 --- /dev/null +++ b/support/regression/tests/bug-460000.c @@ -0,0 +1,44 @@ +/* bug 460000 + */ +#include + +int +func( int a ) +{ + return a; +} + +int x = -1024; + +void +testByteShift(void) +{ + ASSERT(func( x >> 8 ) == -4); + ASSERT(func( x / 256 ) == -4); +} + +void +testOtherSignedShifts(void) +{ + volatile int left; + + left = -2345; + ASSERT(left >> 3 == (-2345>>3)); + ASSERT(left >> 8 == (-2345>>8)); + ASSERT(left >> 9 == (-2345>>9)); +} + +void +testShiftByParam(void) +{ + volatile int left, count; + + left = -2345; + + count = 3; + ASSERT(left >> count == (-2345>>3)); + count = 8; + ASSERT(left >> count == (-2345>>8)); + count = 9; + ASSERT(left >> count == (-2345>>9)); +}