diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1996-06-18 06:32:43 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1996-06-18 06:32:43 -0400 |
commit | 489af5d14b2291aa2e2118819060b12be7e1a0f8 (patch) | |
tree | 25454a254d472332040badb8022657067ad84984 /gcc | |
parent | 5e31e473a70fd565eb772e3427ee7441ddfb0ea2 (diff) | |
download | gcc-489af5d14b2291aa2e2118819060b12be7e1a0f8.zip gcc-489af5d14b2291aa2e2118819060b12be7e1a0f8.tar.gz gcc-489af5d14b2291aa2e2118819060b12be7e1a0f8.tar.bz2 |
(pointer_int_sum): Convert integer to both signedness and precision of
sizetype.
From-SVN: r12291
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-typeck.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 06ef493..d2abd72 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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 |