diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-01-31 14:33:44 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-22 10:44:07 +0200 |
commit | 5105de335368f88cb75acbc9bd30984bd49469c1 (patch) | |
tree | a284d4d960f02959961261e810109f1cd16f84ac | |
parent | f120fa236752feec39797020b55cd2f0c2729473 (diff) | |
download | gcc-5105de335368f88cb75acbc9bd30984bd49469c1.zip gcc-5105de335368f88cb75acbc9bd30984bd49469c1.tar.gz gcc-5105de335368f88cb75acbc9bd30984bd49469c1.tar.bz2 |
ada: Fix handling of constrained array declarations in declare-expression
They need to go through Constrain_Array or else they do not really work.
gcc/ada/
* sem_ch3.adb (Find_Type_Of_Object): In a spec expression, also set
the Scope of the type, and call Constrain_Array for array subtypes.
-rw-r--r-- | gcc/ada/sem_ch3.adb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 66013ca..7596a59 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -18417,10 +18417,10 @@ package body Sem_Ch3 is Set_Etype (T, Base_T); Mutate_Ekind (T, Subtype_Kind (Ekind (Base_T))); Set_Parent (T, Obj_Def); + Set_Scope (T, Current_Scope); if Ekind (T) = E_Array_Subtype then - Set_First_Index (T, First_Index (Base_T)); - Set_Is_Constrained (T); + Constrain_Array (T, Obj_Def, Related_Nod, T, 'P'); elsif Ekind (T) = E_Record_Subtype then Set_First_Entity (T, First_Entity (Base_T)); |