From b200d1aa65136d8ced8ca4b9c50d6754d4b685d4 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Wed, 24 Jan 1996 11:31:38 -0800 Subject: [PATCH] (pointer_int_sum): Use TYPE_PRECISION (sizetype) not POINTER_SIZE to agree with expr.c. From-SVN: r11088 --- gcc/c-typeck.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index a602f7f8fdf..5144d34b6c6 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2645,11 +2645,11 @@ pointer_int_sum (resultcode, ptrop, intop) intop = convert (int_type, TREE_OPERAND (intop, 0)); } - /* Convert the integer argument to a type the same size as a pointer + /* 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)) != POINTER_SIZE) - intop = convert (type_for_size (POINTER_SIZE, 0), intop); + if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype)) + intop = convert (type_for_size (TYPE_PRECISION (sizetype), 0), intop); /* Replace the integer argument with a suitable product by the object size. Do this multiplication as signed, then convert to the appropriate -- 2.30.2