Allow pointers to be short
authorMichael Meissner <meissner@gcc.gnu.org>
Sun, 29 Sep 1996 16:42:27 +0000 (16:42 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Sun, 29 Sep 1996 16:42:27 +0000 (16:42 +0000)
From-SVN: r12855

gcc/c-typeck.c

index 9e97bffe006633cb41201cc69a3c2695aa55fe78..0994ec380fa789cfb0e8d474acd1158b03bf35b7 100644 (file)
@@ -2711,10 +2711,12 @@ pointer_diff (op0, op1)
     }
 
   /* First do the subtraction as integers;
-     then drop through to build the divide operator.  */
+     then drop through to build the divide operator.
+     Do not do default conversions on the minus operator
+     in case restype is a short type.  */
 
   op0 = build_binary_op (MINUS_EXPR, convert (restype, op0),
-                        convert (restype, op1), 1);
+                        convert (restype, op1), 0);
   /* This generates an error if op1 is pointer to incomplete type.  */
   if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (op1))) == 0)
     error ("arithmetic on pointer to an incomplete type");