diff options
-rw-r--r-- | src/vhdl/sem_expr.adb | 3 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap3.adb | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index 671d45ed5..51d74796c 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -3772,6 +3772,8 @@ package body Sem_Expr is -- and statically match the subtype of the aggregate. if Aggr_Constrained then A_Subtype := Create_Array_Subtype (Base_Type, Get_Location (Aggr)); + -- FIXME: extract element subtype ? + Set_Element_Subtype (A_Subtype, Get_Element_Subtype (Aggr_Type)); Type_Staticness := Get_Type_Staticness (A_Subtype); for I in Infos'Range loop Set_Nth_Element (Get_Index_Subtype_List (A_Subtype), I - 1, @@ -3781,6 +3783,7 @@ package body Sem_Expr is end loop; Set_Type_Staticness (A_Subtype, Type_Staticness); Set_Index_Constraint_Flag (A_Subtype, True); + -- FIXME: the element can be unconstrained. Set_Constraint_State (A_Subtype, Fully_Constrained); Set_Type (Aggr, A_Subtype); Set_Literal_Subtype (Aggr, A_Subtype); diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index 7d2db0b70..2d7a126a2 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -1045,6 +1045,7 @@ package body Trans.Chap3 is procedure Translate_Array_Subtype_Definition (Def : Iir_Array_Subtype_Definition; Parent_Type : Iir) is + El_Type : constant Iir := Get_Element_Subtype (Def); Info : constant Type_Info_Acc := Get_Info (Def); Pinfo : constant Type_Info_Acc := Get_Info (Parent_Type); @@ -1061,7 +1062,7 @@ package body Trans.Chap3 is Info.B := Pinfo.B; Info.S := Pinfo.S; if not Info.Type_Locally_Constrained - or else not Is_Static_Type (Get_Info (Get_Element_Subtype (Def))) + or else not Is_Static_Type (Get_Info (El_Type)) then -- This is a complex type as the size is not known at compile -- time. @@ -1070,7 +1071,10 @@ package body Trans.Chap3 is Info.Ortho_Ptr_Type := Pinfo.B.Base_Ptr_Type; else -- Length is known. Create a constrained array. - El_Constrained := Get_Array_Element_Constraint (Def) /= Null_Iir; + -- True if this definition has constrained the element. + El_Constrained := Is_Fully_Constrained_Type (El_Type) + and then not Is_Fully_Constrained_Type (Get_Element_Subtype + (Parent_Type)); Info.Type_Mode := Type_Mode_Static_Array; Info.Ortho_Type (Mode_Signal) := O_Tnode_Null; Info.Ortho_Ptr_Type (Mode_Signal) := O_Tnode_Null; |