PR c/27273
* c-common.c (convert_and_check): only track TREE_CONSTANT_OVERFLOW
for CONSTANT_CLASS_P expressions.
* gcc.dg/overflow-warn-5.c: New testcase.
From-SVN: r114238
+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
/* 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))
+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
--- /dev/null
+/* 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" } */
+}