summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/attribs.c8
-rw-r--r--gcc/c-common.c12
3 files changed, 18 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e8eb55880b7..bf6cf528f20 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/attribs.c b/gcc/attribs.c
index 1aab101c624..fd11a96700f 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -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)
{
diff --git a/gcc/c-common.c b/gcc/c-common.c
index fa555a72588..d58d326b5f4 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -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;