OSDN Git Service

(pointer_int_sum): Convert integer to both signedness and precision of
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Jun 1996 10:32:43 +0000 (10:32 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Jun 1996 10:32:43 +0000 (10:32 +0000)
sizetype.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@12291 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-typeck.c

index 06ef493..d2abd72 100644 (file)
@@ -2649,8 +2649,10 @@ pointer_int_sum (resultcode, ptrop, intop)
   /* Convert the integer argument to a type the same size as sizetype
      so the multiply won't overflow spuriously.  */
 
-  if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype))
-    intop = convert (type_for_size (TYPE_PRECISION (sizetype), 0), intop);
+  if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype)
+      || TREE_UNSIGNED (TREE_TYPE (intop)) != TREE_UNSIGNED (sizetype))
+    intop = convert (type_for_size (TYPE_PRECISION (sizetype), 
+                                   TREE_UNSIGNED (sizetype)), intop);
 
   /* Replace the integer argument with a suitable product by the object size.
      Do this multiplication as signed, then convert to the appropriate