This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed, 4.0] fix PR/25169
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 30 Nov 2005 17:32:57 +0100
- Subject: [committed, 4.0] fix PR/25169
This bug is a checking failure on trees; it is caused by a thinko in the
4.0 version of PR24599. The two had to be different because of the
cleanups to TREE_CONSTANT_OVERFLOW and TREE_OVERFLOW in 4.1 and later,
and the 4.1 version does not have this bug.
The bug causes regressions with checking enabled. It is otherwise
harmless, because if the TREE_CONSTNAT_OVERFLOW bit is not applicable to
the tree, the `if' condition will not trigger:
else if (TREE_CONSTANT_OVERFLOW (ovalue) && CONSTANT_CLASS_P (ovalue))
Indeed, the obvious fix I am committing is just to exchange the two arms
of the && expression. Bootstrapped/regtested C only on
i686-pc-linux-gnu with checking enabled, fixes the aforementioned failures.
Paolo
2005-11-30 Paolo Bonzini <bonzini@gnu.org>
* c-typeck.c (build_c_cast): Test CONSTANT_CLASS_P before
accessing fields that are only defined for constants.
Index: c-typeck.c
===================================================================
--- c-typeck.c (revision 107706)
+++ c-typeck.c (working copy)
@@ -3327,7 +3327,7 @@ build_c_cast (tree type, tree expr)
value = copy_node (value);
TREE_OVERFLOW (value) = true;
}
- else if (TREE_CONSTANT_OVERFLOW (ovalue) && CONSTANT_CLASS_P (ovalue))
+ else if (CONSTANT_CLASS_P (ovalue) && TREE_CONSTANT_OVERFLOW (ovalue))
{
/* When casting a constant, always reset TREE_OVERFLOW, but
still copy TREE_CONSTANT_OVERFLOW from OVALUE. */