diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-11-28 20:46:00 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-12-19 15:27:49 +0100 |
commit | 80a63cc744e9f16ace1e007f8973e97448742335 (patch) | |
tree | ceeea92d3707049a5bccbc69213209b8dcae5253 /gcc/ada/sem_ch3.adb | |
parent | 35ef3e08ec5bc03fe2cb80efc3271168bc6d419e (diff) | |
download | gcc-80a63cc744e9f16ace1e007f8973e97448742335.zip gcc-80a63cc744e9f16ace1e007f8973e97448742335.tar.gz gcc-80a63cc744e9f16ace1e007f8973e97448742335.tar.bz2 |
ada: Rename Is_Constr_Subt_For_UN_Aliased flag
The flag is set on the constructed subtype of an object with unconstrained
nominal subtype that is aliased and is used by the code generator to adjust
the layout of the object.
But it is actually only used for array subtypes, where it determines whether
the object is allocated with its bounds, and this usage could be extended to
other cases than the original case.
gcc/ada/
* einfo.ads (Is_Constr_Subt_For_UN_Aliased): Rename into...
(Is_Constr_Array_Subt_With_Bounds): ...this.
* exp_ch3.adb (Expand_N_Object_Declaration): Adjust to above
renaming and remove now redundant test.
* sem_ch3.adb (Analyze_Object_Declaration): Likewise, but set
Is_Constr_Array_Subt_With_Bounds only on arrays.
* gen_il-fields.ads (Opt_Field_Enum): Apply same renaming.
* gen_il-gen-gen_entities.adb (Entity_Kind): Likewise.
* gen_il-internals.adb (Image): Remove specific processing for
Is_Constr_Subt_For_UN_Aliased.
* treepr.adb (Image): Likewise.
* gcc-interface/decl.cc (gnat_to_gnu_entity): Adjust to renaming
and remove now redundant tests.
* gcc-interface/trans.cc (Identifier_to_gnu): Likewise.
(Call_to_gnu): Likewise.
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 96fd16d..33d8f11 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -4957,23 +4957,32 @@ package body Sem_Ch3 is if Act_T /= T then declare - Full_View_Present : constant Boolean := - Is_Private_Type (Act_T) - and then Present (Full_View (Act_T)); + Full_Act_T : constant Entity_Id := + (if Is_Private_Type (Act_T) + then Full_View (Act_T) + else Empty); -- Propagate attributes to full view when needed begin Set_Is_Constr_Subt_For_U_Nominal (Act_T); - if Full_View_Present then - Set_Is_Constr_Subt_For_U_Nominal (Full_View (Act_T)); + if Present (Full_Act_T) then + Set_Is_Constr_Subt_For_U_Nominal (Full_Act_T); end if; - if Aliased_Present (N) then - Set_Is_Constr_Subt_For_UN_Aliased (Act_T); + -- If the object is aliased, then it may be pointed to by an + -- access-to-unconstrained-array value, which means that it + -- must be allocated with its bounds. - if Full_View_Present then - Set_Is_Constr_Subt_For_UN_Aliased (Full_View (Act_T)); + if Aliased_Present (N) + and then (Is_Array_Type (Act_T) + or else (Present (Full_Act_T) + and then Is_Array_Type (Full_Act_T))) + then + Set_Is_Constr_Array_Subt_With_Bounds (Act_T); + + if Present (Full_Act_T) then + Set_Is_Constr_Array_Subt_With_Bounds (Full_Act_T); end if; end if; |