re PR c/18282 (PR c/17384 patch causes regression from 3.4.2)

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.

From-SVN: r91978
This commit is contained in:
Richard Henderson 2004-12-09 14:55:41 -08:00 committed by Richard Henderson
parent 88b3da50a8
commit d183862150
3 changed files with 18 additions and 9 deletions

View File

@ -1,3 +1,10 @@
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

View 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)
{

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