diff options
| author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-23 10:21:03 +0000 |
|---|---|---|
| committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-23 10:21:03 +0000 |
| commit | 39413c59069dd2300ce76b101877dcdca9c98fac (patch) | |
| tree | d3b88bd138998e6837a60bb0cba5af848f0e0005 | |
| parent | a8bc3c8fc609cf58fc2747cb611c330e451411e1 (diff) | |
| download | ppe42-gcc-39413c59069dd2300ce76b101877dcdca9c98fac.tar.gz ppe42-gcc-39413c59069dd2300ce76b101877dcdca9c98fac.zip | |
* gcc-interface/decl.c (validate_alignment): For the case of an
implicit array base type, look for alignment clause on first subtype.
Code clean up.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149994 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ada/gcc-interface/decl.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 67d8cd1b0c4..7d96c9a3c6d 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -6512,17 +6512,21 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, if (Present (Component_Clause (gnat_field))) { + Entity_Id gnat_parent + = Parent_Subtype (Underlying_Type (Scope (gnat_field))); + gnu_pos = UI_To_gnu (Component_Bit_Offset (gnat_field), bitsizetype); gnu_size = validate_size (Esize (gnat_field), gnu_field_type, gnat_field, FIELD_DECL, false, true); - /* Ensure the position does not overlap with the parent subtype, - if there is one. */ - if (Present (Parent_Subtype (Underlying_Type (Scope (gnat_field))))) + /* Ensure the position does not overlap with the parent subtype, if there + is one. This test is omitted if the parent of the tagged type has a + full rep clause since, in this case, component clauses are allowed to + overlay the space allocated for the parent type and the front-end has + checked that there are no overlapping components. */ + if (Present (gnat_parent) && !Is_Fully_Repped_Tagged_Type (gnat_parent)) { - tree gnu_parent - = gnat_to_gnu_type (Parent_Subtype - (Underlying_Type (Scope (gnat_field)))); + tree gnu_parent = gnat_to_gnu_type (gnat_parent); if (TREE_CODE (TYPE_SIZE (gnu_parent)) == INTEGER_CST && tree_int_cst_lt (gnu_pos, TYPE_SIZE (gnu_parent))) @@ -7674,9 +7678,19 @@ validate_alignment (Uint alignment, Entity_Id gnat_entity, unsigned int align) if (Error_Posted (gnat_entity) && !Has_Alignment_Clause (gnat_entity)) return align; - /* Post the error on the alignment clause if any. */ + /* Post the error on the alignment clause if any. Note, for the implicit + base type of an array type, the alignment clause is on the first + subtype. */ if (Present (Alignment_Clause (gnat_entity))) gnat_error_node = Expression (Alignment_Clause (gnat_entity)); + + else if (Is_Itype (gnat_entity) + && Is_Array_Type (gnat_entity) + && Etype (gnat_entity) == gnat_entity + && Present (Alignment_Clause (First_Subtype (gnat_entity)))) + gnat_error_node = + Expression (Alignment_Clause (First_Subtype (gnat_entity))); + else gnat_error_node = gnat_entity; |

