The code for shifts is now similar to code for binary arithmetic operations, except that only the first argument is considered, as required by the ISO C standard.
Unified · Split
| @@ -1679,7 +1679,9 @@ ST_FUNC void gen_op(int op) · 1678 unmodified lines | ||
| 1679 | 1679 | tcc_error("invalid operands for binary operation"); |
| 1680 | 1680 | goto std_op; |
| 1681 | 1681 | } else if (op == TOK_SHR || op == TOK_SAR || op == TOK_SHL) { |
| 1682 | − t = (bt1 == VT_LLONG ? VT_LLONG : VT_INT) | (t1 & VT_UNSIGNED); | |
| 1682 | + t = bt1 == VT_LLONG ? VT_LLONG : VT_INT; | |
| 1683 | + if ((t1 & (VT_BTYPE | VT_UNSIGNED)) == (t | VT_UNSIGNED)) | |
| 1684 | + t |= VT_UNSIGNED; | |
| 1683 | 1685 | goto std_op; |
| 1684 | 1686 | } else if (bt1 == VT_LLONG || bt2 == VT_LLONG) { |
| 1685 | 1687 | /* cast to biggest op */ |