Unified · Split
| @@ -5764,6 +5764,10 @@ void force_charshort_cast(int t) · 5763 unmodified lines | ||
| 5764 | 5764 | bits = 32 - bits; |
| 5765 | 5765 | vpushi(bits); |
| 5766 | 5766 | gen_op(TOK_SHL); |
| 5767 | + /* result must be signed or the SAR is converted to an SHL | |
| 5768 | + This was not the case when "t" was a signed short | |
| 5769 | + and the last value on the stack was an unsigned int */ | |
| 5770 | + vtop->type.t &= ~VT_UNSIGNED; | |
| 5767 | 5771 | vpushi(bits); |
| 5768 | 5772 | gen_op(TOK_SAR); |
| 5769 | 5773 | } |