This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/27273] [4.2 regression] tree check fail for legal code when convert returns a constant from an expression that was not constant



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]