diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-12-16 10:34:33 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-12-16 10:34:33 +0000 |
commit | a517d6c19a572a4aa37569f54186883d70627686 (patch) | |
tree | cb4c651cb474cafe0000663fa7df2e7379d4acad /gcc/testsuite/gnat.dg/specs | |
parent | 2cee58d81076c99ab3db3305c1850bf79fa12f17 (diff) | |
download | gcc-a517d6c19a572a4aa37569f54186883d70627686.zip gcc-a517d6c19a572a4aa37569f54186883d70627686.tar.gz gcc-a517d6c19a572a4aa37569f54186883d70627686.tar.bz2 |
[Ada] AI12-0001: Independence and Representation clauses for atomic objects
2019-12-16 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* gcc-interface/decl.c (gnat_to_gnu_entity): Adjust calls to
validate_size.
(gnat_to_gnu_component_type): Likewise.
(gnat_to_gnu_field): Likewise and pass string for error messages.
(components_need_strict_alignment): Remove test on Is_Aliased and
add test for the independence of the component.
(validate_size): Add S1 and S2 string parameters and use them to
give better error messages for fields. Tweak a couple of messages.
* einfo.ads (Has_Independent_Components): Document more cases.
(Is_Independent): Likewise.
(Strict_Alignment): Document new semantics.
* exp_ch9.adb (Install_Private_Data_Declarations): Also set the
Is_Independent flag along with Is_Aliased on the renaming
entity.
* freeze.adb (Size_Known): Remove always-false test and add test
for the strict-alignment on the record type. Remove redundant
tests and add test for the strict-alignment on the component
type.
(Check_Strict_Alignment): Set the flag if the type is by-ref and
remove now redundant conditions. Set the flag on an array type
if it has aliased components. In the record type case, do not
set type for C_Pass_By_Copy convention.
(Freeze_Array_Type): Move code checking for conflicts between
representation aspects and clauses to before specific handling
of packed array types. Give a warnind instead of an error for a
conflict with pragma Pack. Do not test Has_Pragma_Pack for the
specific handling of packed array types.
(Freeze_Record_Type): Move error checking of representation
clause to...
(Freeze_Entity): ...here after Check_Strict_Alignment is called.
* sem_aggr.adb (Array_Aggr_Subtype): Also set the Is_Independent
flag along with Is_Aliased on the Itype.
* sem_ch13.adb (Check_Record_Representation_Clause): Do not set
the RM size for a strict-alignment type.
* sem_ch3.adb (Add_Interface_Tag_Components): Also set the
Is_Independent flag along with Is_Aliased on the tag.
(Add_Interface_Tag_Components): Likewise on the offset.
(Analyze_Component_Declaration): Likewise on the component.
(Analyze_Object_Declaration): Likewise on the object.
(Constrain_Array): Likewise on the array.
(Record_Type_Declaration: Likewise on the tag.
(Array_Type_Declaration): Also set the
Has_Independent_Components flag along with
Has_Aliased_Components on the array.
(Copy_Array_Base_Type_Attributes): Copy
Has_Independent_Components.
(Copy_Array_Subtype_Attributes): Copy Is_Atomic, Is_Independent
and Is_Volatile_Full_Access.
(Analyze_Iterator_Specification): Set Is_Independent on the loop
variable according to Independent_Components on the array.
* sem_ch5.adb: Likewise.
* sem_ch6.adb (Process_Formals): Also set the Is_Independent
flag along with Is_Aliased on the formal.
gcc/testsuite/
* gnat.dg/specs/clause_on_volatile.ads,
gnat.dg/specs/size_clause3.ads: Update expected diagnostics.
From-SVN: r279430
Diffstat (limited to 'gcc/testsuite/gnat.dg/specs')
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/clause_on_volatile.ads | 6 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/size_clause3.ads | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/gcc/testsuite/gnat.dg/specs/clause_on_volatile.ads b/gcc/testsuite/gnat.dg/specs/clause_on_volatile.ads index 0dcffbc..157f724 100644 --- a/gcc/testsuite/gnat.dg/specs/clause_on_volatile.ads +++ b/gcc/testsuite/gnat.dg/specs/clause_on_volatile.ads @@ -57,7 +57,7 @@ package Clause_On_Volatile is end record; For V1'Alignment use 4; for V1 use record - VW at 0 range 0 .. 15; + VW at 0 range 0 .. 15; -- { dg-error "too small*" } end record; type V2 is record @@ -67,7 +67,7 @@ package Clause_On_Volatile is For V2'Alignment use 4; for V2 use record B at 0 range 0 .. 7; - VW at 1 range 0 .. 31; + VW at 1 range 0 .. 31; -- { dg-error "must be multiple|alignment" } end record; type V3 is record @@ -77,7 +77,7 @@ package Clause_On_Volatile is For V3'Alignment use 4; for V3 use record B at 0 range 0 .. 7; - VW at 1 range 0 .. 15; + VW at 1 range 0 .. 15; -- { dg-error "must be multiple|alignment|too small" } end record; end Clause_On_Volatile; diff --git a/gcc/testsuite/gnat.dg/specs/size_clause3.ads b/gcc/testsuite/gnat.dg/specs/size_clause3.ads index 12ca2d1..a9ab5c5 100644 --- a/gcc/testsuite/gnat.dg/specs/size_clause3.ads +++ b/gcc/testsuite/gnat.dg/specs/size_clause3.ads @@ -14,7 +14,7 @@ package Size_Clause3 is rr : R1; -- size must be 40 end record; for S1 use record - rr at 0 range 0 .. 39; -- { dg-error "size for .rr. too small" } + rr at 0 range 0 .. 39; -- { dg-error "size for .rr. with aliased part too small" } end record; -- The record is explicitly given alignment 1 so its real type is 40. @@ -44,7 +44,7 @@ package Size_Clause3 is rr : R3; -- size must be 40 end record; for S3 use record - rr at 0 range 0 .. 39; -- { dg-error "size for .rr. too small" } + rr at 0 range 0 .. 39; -- { dg-error "size for .rr. with aliased part too small" } end record; end Size_Clause3; |