c-decl.c (grokdeclarator): Only check TREE_OVERFLOW on INTEGER_CST nodes.
authorRoger Sayle <roger@eyesopen.com>
Sun, 19 Jun 2005 16:55:22 +0000 (16:55 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sun, 19 Jun 2005 16:55:22 +0000 (16:55 +0000)
* c-decl.c (grokdeclarator): Only check TREE_OVERFLOW on
INTEGER_CST nodes.
* c-typeck.c (build_c_cast): Only preserve TREE_OVERFLOW on
CONSTANT_CLASS_P nodes.

From-SVN: r101187

gcc/ChangeLog
gcc/c-decl.c
gcc/c-typeck.c

index 678b0c52a5f01b75a7f298baa7150af46a065413..4d0fbebdc9056e9571ef799b9daf3e12e6a56926 100644 (file)
@@ -1,3 +1,10 @@
+2005-06-19  Roger Sayle  <roger@eyesopen.com>
+
+       * c-decl.c (grokdeclarator): Only check TREE_OVERFLOW on
+       INTEGER_CST nodes.
+       * c-typeck.c (build_c_cast): Only preserve TREE_OVERFLOW on
+       CONSTANT_CLASS_P nodes.
+
 2005-06-19  Richard Henderson  <rth@redhat.com>
 
        * config/ia64/vect.md (vec_extractv2sf_1): Fix cut-and-paste error;
index 8f50b17d1eddaa4bd1aeeba6e78fd84157ef1711..b1260237c98bffa130ebb6ee2934910974e5170d 100644 (file)
@@ -4192,7 +4192,8 @@ grokdeclarator (const struct c_declarator *declarator,
                       index_type, before the subtraction.  Handling
                       this case seems like an unnecessary
                       complication.  */
-                   if (TREE_OVERFLOW (itype))
+                   if (TREE_CODE (itype) == INTEGER_CST
+                       && TREE_OVERFLOW (itype))
                      {
                        error ("size of array %qs is too large", name);
                        type = error_mark_node;
@@ -4357,6 +4358,7 @@ grokdeclarator (const struct c_declarator *declarator,
 
   if (TREE_CODE (type) == ARRAY_TYPE
       && COMPLETE_TYPE_P (type)
+      && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
       && TREE_OVERFLOW (TYPE_SIZE (type)))
     {
       error ("size of array %qs is too large", name);
index 7dcd577f5389a8b434a064e2cab7b0a69e752855..988d958e911a3ffcb2f08a86febfbd818e886f4b 100644 (file)
@@ -3331,17 +3331,16 @@ build_c_cast (tree type, tree expr)
       /* Ignore any integer overflow caused by the cast.  */
       if (TREE_CODE (value) == INTEGER_CST)
        {
-         if (EXPR_P (ovalue))
-           /* If OVALUE had overflow set, then so will VALUE, so it
-              is safe to overwrite.  */
-           TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue);
+         /* If OVALUE had overflow set, then so will VALUE, so it
+            is safe to overwrite.  */
+         if (CONSTANT_CLASS_P (ovalue))
+           {
+             TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue);
+             /* Similarly, constant_overflow cannot have become cleared.  */
+             TREE_CONSTANT_OVERFLOW (value) = TREE_CONSTANT_OVERFLOW (ovalue);
+           }
          else
            TREE_OVERFLOW (value) = 0;
-         
-         if (CONSTANT_CLASS_P (ovalue))
-           /* Similarly, constant_overflow cannot have become
-              cleared.  */
-           TREE_CONSTANT_OVERFLOW (value) = TREE_CONSTANT_OVERFLOW (ovalue);
        }
     }