diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-01-22 18:15:49 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-01-22 18:15:49 +0000 |
commit | 0bf3823958c2f4322ab59aae959b08fb82c0c114 (patch) | |
tree | 66c68bdf36ff81a3bd62fcd604dbe3bcc4131fc6 /gcc/ada/decl.c | |
parent | 255ef0345c9976d876677058f9beec62eb56aa28 (diff) | |
download | gcc-0bf3823958c2f4322ab59aae959b08fb82c0c114.zip gcc-0bf3823958c2f4322ab59aae959b08fb82c0c114.tar.gz gcc-0bf3823958c2f4322ab59aae959b08fb82c0c114.tar.bz2 |
decl.c (components_to_record): Do not reuse the empty union type if there is a representation clause on the record.
* decl.c (components_to_record): Do not reuse the empty union type
if there is a representation clause on the record.
* trans.c (addressable_p): Return true for INTEGER_CST.
From-SVN: r131733
Diffstat (limited to 'gcc/ada/decl.c')
-rw-r--r-- | gcc/ada/decl.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 2ddfe5a..c57e145 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -6007,11 +6007,15 @@ components_to_record (tree gnu_record_type, Node_Id component_list, gnu_union_name = concat_id_with_name (gnu_name, IDENTIFIER_POINTER (gnu_var_name)); - if (!gnu_field_list && TREE_CODE (gnu_record_type) == UNION_TYPE) + /* Reuse an enclosing union if all fields are in the variant part + and there is no representation clause on the record, to match + the layout of C unions. There is an associated check below. */ + if (!gnu_field_list + && TREE_CODE (gnu_record_type) == UNION_TYPE + && !TYPE_PACKED (gnu_record_type)) gnu_union_type = gnu_record_type; else { - gnu_union_type = make_node (unchecked_union ? UNION_TYPE : QUAL_UNION_TYPE); @@ -6116,7 +6120,9 @@ components_to_record (tree gnu_record_type, Node_Id component_list, return. */ if (gnu_union_type == gnu_record_type) { - gcc_assert (!gnu_field_list && unchecked_union); + gcc_assert (unchecked_union + && !gnu_field_list + && !gnu_our_rep_list); return; } |