OSDN Git Service

PR c/18282
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Dec 2004 22:55:41 +0000 (22:55 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Dec 2004 22:55:41 +0000 (22:55 +0000)
        * attribs.c (decl_attributes): Use relayout_decl.
        * c-common.c (handle_mode_attribute): Copy all relevant type
        parameters from the new underlying integral type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91978 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/attribs.c
gcc/c-common.c

index e8eb558..bf6cf52 100644 (file)
@@ -1,5 +1,12 @@
 2004-12-09  Richard Henderson  <rth@redhat.com>
 
+       PR c/18282
+       * attribs.c (decl_attributes): Use relayout_decl.
+       * c-common.c (handle_mode_attribute): Copy all relevant type
+       parameters from the new underlying integral type.
+
+2004-12-09  Richard Henderson  <rth@redhat.com>
+
        * c-common.c (shorten_compare): Don't special-case min/maxval
        for C enumerations.
 
index 1aab101..fd11a96 100644 (file)
@@ -259,13 +259,7 @@ decl_attributes (tree *node, tree attributes, int flags)
          && (TREE_CODE (*node) == VAR_DECL
              || TREE_CODE (*node) == PARM_DECL
              || TREE_CODE (*node) == RESULT_DECL))
-       {
-         /* Force a recalculation of mode and size.  */
-         DECL_MODE (*node) = VOIDmode;
-         DECL_SIZE (*node) = 0;
-
-         layout_decl (*node, 0);
-       }
+       relayout_decl (*node);
 
       if (!no_add_attrs)
        {
index fa555a7..d58d326 100644 (file)
@@ -4302,7 +4302,17 @@ handle_mode_attribute (tree *node, tree name, tree args,
 
          if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
            type = build_variant_type_copy (type);
+
+         /* We cannot use layout_type here, because that will attempt
+            to re-layout all variants, corrupting our original.  */
          TYPE_PRECISION (type) = TYPE_PRECISION (typefm);
+         TYPE_MIN_VALUE (type) = TYPE_MIN_VALUE (typefm);
+         TYPE_MAX_VALUE (type) = TYPE_MAX_VALUE (typefm);
+         TYPE_SIZE (type) = TYPE_SIZE (typefm);
+         TYPE_SIZE_UNIT (type) = TYPE_SIZE_UNIT (typefm);
+         if (!TYPE_USER_ALIGN (type))
+           TYPE_ALIGN (type) = TYPE_ALIGN (typefm);
+
          typefm = type;
        }
       else if (VECTOR_MODE_P (mode)
@@ -4314,8 +4324,6 @@ handle_mode_attribute (tree *node, tree name, tree args,
        }
 
       *node = typefm;
-
-      /* No need to layout the type here.  The caller should do this.  */
     }
 
   return NULL_TREE;