tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tcc 0.9.23 shift generation bug


From: Fabrice Bellard
Subject: Re: [Tinycc-devel] tcc 0.9.23 shift generation bug
Date: Sun, 04 Sep 2005 01:03:36 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

Zdenek Pavlas wrote:
Signed shifts of signed integers should not give unsigned results.
This fix is probably a better one.

--- tcc.c.orig  2005-06-18 00:09:15.000000000 +0200
+++ tcc.c       2005-06-28 12:17:44.472171840 +0200
@@ -5628,7 +5628,8 @@
         t = VT_INT;
         /* convert to unsigned if it does not fit in an integer */
         if ((t1 & (VT_BTYPE | VT_UNSIGNED)) == (VT_INT | VT_UNSIGNED) ||
-            (t2 & (VT_BTYPE | VT_UNSIGNED)) == (VT_INT | VT_UNSIGNED))
+            (t2 & (VT_BTYPE | VT_UNSIGNED)) == (VT_INT | VT_UNSIGNED) &&
+            (op != TOK_SAR))
             t |= VT_UNSIGNED;
     std_op:
         /* XXX: currently, some unsigned operations are explicit, so


OK for the bug, but this fix is still incorrect : the shift operations should be handled separately because they keep the type of the first operand.

Fabrice.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]