aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/typeck.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-10-20 17:51:52 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-10-20 13:51:52 -0400
commit444751385724c1ed44e29047bfd96bcdba91f522 (patch)
tree0179fd011caa1eb6eecaae68b203054a3ee3c1c4 /gcc/cp/typeck.c
parent23ccfa6dbb713011bc4445e74c5b243673f86620 (diff)
downloadgcc-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/cp/typeck.c')
-rw-r--r--gcc/cp/typeck.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index c265808..d72d8e6 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6353,7 +6353,16 @@ dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum)
cp_warning ("%s of negative value `%E' to `%T'",
errtype, expr, type);
}
- overflow_warning (expr);
+
+ /* Suppress warning for a sizetype since we never used to issue it.
+ ??? This needs to be looked at more carefully someday. */
+ if (TREE_CODE (expr) == INTEGER_CST
+ && TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (TREE_TYPE (expr)))
+ TREE_OVERFLOW (expr) = TREE_CONSTANT_OVERFLOW (expr) = 0;
+ else
+ overflow_warning (expr);
+
if (TREE_CONSTANT (expr))
expr = fold (expr);
}