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

--
Zdenek Pavlas


_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to