Commit d117b270 by Dirk Mueller Committed by Dirk Mueller

re PR c/27273 (tree check fail for legal code when convert returns a constant…

re PR c/27273 (tree check fail for legal code when convert returns a constant from an expression that was not constant)

        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
parent 16464cc1
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
......
......@@ -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))
......
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
/* 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" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment