aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-common.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/overflow-warn-5.c7
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c5470be..9cb3bef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-05-30 Dirk Mueller <dmueller@suse.de>
+
+ PR c/27273
+ * c-common.c (convert_and_check): Only track TREE_CONSTANT_OVERFLOW
+ for CONSTANT_CLASS_P expresisons.
+
2006-05-30 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/27718
diff --git a/gcc/c-common.c b/gcc/c-common.c
index a27f5d3..dea8389 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1083,7 +1083,8 @@ convert_and_check (tree type, tree expr)
/* Do not diagnose overflow in a constant expression merely
because a conversion overflowed. */
- TREE_CONSTANT_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (expr);
+ TREE_CONSTANT_OVERFLOW (t) = CONSTANT_CLASS_P (expr)
+ && TREE_CONSTANT_OVERFLOW (expr);
/* No warning for converting 0x80000000 to int. */
if (!(TYPE_UNSIGNED (type) < TYPE_UNSIGNED (TREE_TYPE (expr))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dc0ec7c..d5b7094 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-30 Dirk Mueller <dmueller@suse.de>
+
+ PR c/27273
+ * gcc.dg/overflow-warn-5.c: New test.
+
2006-05-30 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/27718
diff --git a/gcc/testsuite/gcc.dg/overflow-warn-5.c b/gcc/testsuite/gcc.dg/overflow-warn-5.c
new file mode 100644
index 0000000..472d4a7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/overflow-warn-5.c
@@ -0,0 +1,7 @@
+/* PR c/27273 */
+/* { dg-do compile } */
+/* { dg-options "-Woverflow" } */
+
+unsigned char rx_async(unsigned char p) {
+ return p & 512; /* { dg-warning "overflow in implicit constant conversion" } */
+}