diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2000-10-20 17:51:52 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2000-10-20 13:51:52 -0400 |
commit | 444751385724c1ed44e29047bfd96bcdba91f522 (patch) | |
tree | 0179fd011caa1eb6eecaae68b203054a3ee3c1c4 /gcc/fold-const.c | |
parent | 23ccfa6dbb713011bc4445e74c5b243673f86620 (diff) | |
download | gcc-444751385724c1ed44e29047bfd96bcdba91f522.zip gcc-444751385724c1ed44e29047bfd96bcdba91f522.tar.gz gcc-444751385724c1ed44e29047bfd96bcdba91f522.tar.bz2 |
fold-const.c (force_fit_type): Unsigned values can overflow if they are sizetype.
* fold-const.c (force_fit_type): Unsigned values can overflow
if they are sizetype.
(int_const_binop): Don't use cache if overflows.
* cp/typeck.c (dubious_conversion_warning): Suppress if
TYPE_IS_SIZETYPE.
From-SVN: r36970
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c8b0fd2..efd1055 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -216,8 +216,11 @@ force_fit_type (t, overflow) TREE_INT_CST_LOW (t) &= ~((unsigned HOST_WIDE_INT) (-1) << prec); } - /* Unsigned types do not suffer sign extension or overflow. */ - if (TREE_UNSIGNED (TREE_TYPE (t))) + /* Unsigned types do not suffer sign extension or overflow unless they + are a sizetype. */ + if (TREE_UNSIGNED (TREE_TYPE (t)) + && ! (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE + && TYPE_IS_SIZETYPE (TREE_TYPE (t)))) return overflow; /* If the value's sign bit is set, extend the sign. */ @@ -1604,7 +1607,8 @@ int_const_binop (code, arg1, arg2, notrunc, forsize) abort (); } - if (forsize && hi == 0 && low < 10000) + if (forsize && hi == 0 && low < 10000 + && overflow == 0 && ! TREE_OVERFLOW (arg1) && ! TREE_OVERFLOW (arg2)) return size_int_type_wide (low, TREE_TYPE (arg1)); else { |