aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-08-29 19:15:19 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-08-29 19:15:19 -0400
commit1bcf5b08b03cebe9de80330e00d0f6473fdf18ee (patch)
tree4ec8e32aa3d8115e64bbadbed291d1990e94fae4 /gcc/c-common.c
parentc0a2dc127469f0509048efe7bd277f2813603f2b (diff)
downloadgcc-1bcf5b08b03cebe9de80330e00d0f6473fdf18ee.zip
gcc-1bcf5b08b03cebe9de80330e00d0f6473fdf18ee.tar.gz
gcc-1bcf5b08b03cebe9de80330e00d0f6473fdf18ee.tar.bz2
(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
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c13
1 files changed, 7 insertions, 6 deletions
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;