aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMichael Meissner <meissner@gcc.gnu.org>1996-09-29 16:42:27 +0000
committerMichael Meissner <meissner@gcc.gnu.org>1996-09-29 16:42:27 +0000
commit0404429725688df26a9f68ee08e3f303efca5628 (patch)
tree34e3f51065c909354948cfdbd834608f58d915d0 /gcc
parent412c00dcfa6575dc08653a65801e68369d343444 (diff)
downloadgcc-0404429725688df26a9f68ee08e3f303efca5628.zip
gcc-0404429725688df26a9f68ee08e3f303efca5628.tar.gz
gcc-0404429725688df26a9f68ee08e3f303efca5628.tar.bz2
Allow pointers to be short
From-SVN: r12855
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 9e97bff..0994ec3 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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");