This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/27273] [4.2 regression] tree check fail for legal code when convert returns a constant from an expression that was not constant
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Apr 2006 08:04:28 -0000
- Subject: [Bug c/27273] [4.2 regression] tree check fail for legal code when convert returns a constant from an expression that was not constant
- References: <bug-27273-9596@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from pinskia at gcc dot gnu dot org 2006-04-30 08:04 -------
This patch works for me (I have not fully test it yet though):
Index: c-common.c
===================================================================
--- c-common.c (revision 113388)
+++ c-common.c (working copy)
@@ -1080,7 +1080,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);
+ if (TREE_CODE (expr) == INTEGER_CST)
+ TREE_CONSTANT_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (expr);
/* No warning for converting 0x80000000 to int. */
if (!(TYPE_UNSIGNED (type) < TYPE_UNSIGNED (TREE_TYPE (expr))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27273