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: Felix Nawothnig
Subject: Re: [Tinycc-devel] tcc 0.9.23 shift generation bug
Date: Tue, 28 Jun 2005 16:16:13 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

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

Oops. Looks correct (although I'd put the second sub-expression in parentheses for clarity).

Felix




reply via email to

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