History

Incorrect shift result type with 64-bit ABI

On 2012-06-26 15:07:57 +0200, Vincent Lefevre wrote: > ISO C99 TC3 says: [6.5.7#3] "The integer promotions are performed on > each of the operands. The type of the result is that of the promoted > left operand." I've written a patch (attached). Now the shift problems no longer occur with the testcase and with GNU MPFR's "make check". -- Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Vincent Lefevre committed 14 years ago

Commit 240064c1 parent 42c1b6b1 file · +3 −0Browse files

Unified · Split

tccgen.c+3−0
@@ -1678,6 +1678,9 @@ ST_FUNC void gen_op(int op) · 1677 unmodified lines
1678 (op < TOK_ULT || op > TOK_GT))1678 (op < TOK_ULT || op > TOK_GT))
1679 tcc_error("invalid operands for binary operation");1679 tcc_error("invalid operands for binary operation");
1680 goto std_op;1680 goto std_op;
1681 } else if (op == TOK_SHR || op == TOK_SAR || op == TOK_SHL) {
1682 t = (bt1 == VT_LLONG ? VT_LLONG : VT_INT) | (t1 & VT_UNSIGNED);
1683 goto std_op;
1681 } else if (bt1 == VT_LLONG || bt2 == VT_LLONG) {1684 } else if (bt1 == VT_LLONG || bt2 == VT_LLONG) {
1682 /* cast to biggest op */1685 /* cast to biggest op */
1683 t = VT_LLONG;1686 t = VT_LLONG;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t