summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-20 17:51:52 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-20 17:51:52 +0000
commit708d43038f35d7052bd303a4042f9c74b9f69519 (patch)
tree0179fd011caa1eb6eecaae68b203054a3ee3c1c4 /gcc/cp
parentd37bb15e7513b5aff2c62eac53cc657d12c003ff (diff)
downloadgcc-708d43038f35d7052bd303a4042f9c74b9f69519.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36970 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck.c11
2 files changed, 14 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cd6fafa7cc1..3c2e244fb90 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+Fri Oct 20 13:54:59 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * typeck.c (dubious_conversion_warning): Suppress if TYPE_IS_SIZETYPE.
+
2000-10-20 Jeffrey Oldham <oldham@codesourcery.com>
* decl.c (revert_static_member_fn): Fixed typo.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index c26580836c8..d72d8e6c00d 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);
}