From 1bcf5b08b03cebe9de80330e00d0f6473fdf18ee Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 29 Aug 1995 19:15:19 -0400 Subject: (decl_attribute, case A_PACKED): Check is_type first. (decl_attribute, case A_T_UNION): Likewise. Don't access TYPE_FIELDS if DECL is zero. From-SVN: r10292 --- gcc/c-common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gcc') diff --git a/gcc/c-common.c b/gcc/c-common.c index f2715b3..3d5d3f29 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -328,7 +328,7 @@ decl_attributes (node, attributes, prefix_attributes) switch (id) { case A_PACKED: - if (decl == 0) + if (is_type) TYPE_PACKED (type) = 1; else if (TREE_CODE (decl) == FIELD_DECL) DECL_PACKED (decl) = 1; @@ -380,14 +380,15 @@ decl_attributes (node, attributes, prefix_attributes) break; case A_T_UNION: - if (decl != 0 && TREE_CODE (decl) == PARM_DECL + if (is_type && TREE_CODE (type) == UNION_TYPE - && TYPE_MODE (type) == DECL_MODE (TYPE_FIELDS (type))) - DECL_TRANSPARENT_UNION (decl) = 1; - else if (is_type + && (decl == 0 + || TYPE_MODE (type) == DECL_MODE (TYPE_FIELDS (type)))) + TYPE_TRANSPARENT_UNION (type) = 1; + else if (decl != 0 && TREE_CODE (decl) == PARM_DECL && TREE_CODE (type) == UNION_TYPE && TYPE_MODE (type) == DECL_MODE (TYPE_FIELDS (type))) - TYPE_TRANSPARENT_UNION (type) = 1; + DECL_TRANSPARENT_UNION (decl) = 1; else warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); break; -- cgit v1.1