diff options
author | Tristan Gingold | 2013-12-29 03:38:51 +0100 |
---|---|---|
committer | Tristan Gingold | 2013-12-29 03:38:51 +0100 |
commit | efd7628a8a7bfd079d2fd2ebd61c754dffb26178 (patch) | |
tree | e29024f624a26ae067e5cfcae4c545de3582a204 /sem_assocs.adb | |
parent | 1bc2216d457b894545c08d995f43214af6e497f4 (diff) | |
download | ghdl-efd7628a8a7bfd079d2fd2ebd61c754dffb26178.tar.gz ghdl-efd7628a8a7bfd079d2fd2ebd61c754dffb26178.tar.bz2 ghdl-efd7628a8a7bfd079d2fd2ebd61c754dffb26178.zip |
Fix multidimensional array individual association.
Fix missing check in discrete range.
Diffstat (limited to 'sem_assocs.adb')
-rw-r--r-- | sem_assocs.adb | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/sem_assocs.adb b/sem_assocs.adb index 3ee7126..87081f4 100644 --- a/sem_assocs.adb +++ b/sem_assocs.adb @@ -540,22 +540,30 @@ package body Sem_Assocs is end if; end Add_Individual_Association; - procedure Finish_Individual_Assoc_Array_Subtype (Assoc : Iir; Atype : Iir) + procedure Finish_Individual_Assoc_Array_Subtype + (Assoc : Iir; Atype : Iir; Dim : Positive) is - Index_Tlist : Iir_List; + Index_Tlist : constant Iir_List := Get_Index_Subtype_List (Atype); + Nbr_Dims : constant Natural := Get_Nbr_Elements (Index_Tlist); Index_Type : Iir; Low, High : Iir; Chain : Iir; + El : Iir; begin - Index_Tlist := Get_Index_Subtype_List (Atype); - for I in Natural loop - Index_Type := Get_Nth_Element (Index_Tlist, I); - exit when Index_Type = Null_Iir; - Chain := Get_Individual_Association_Chain (Assoc); - Sem_Choices_Range - (Chain, Index_Type, False, False, Get_Location (Assoc), Low, High); - Set_Individual_Association_Chain (Assoc, Chain); - end loop; + Index_Type := Get_Nth_Element (Index_Tlist, Dim - 1); + Chain := Get_Individual_Association_Chain (Assoc); + Sem_Choices_Range + (Chain, Index_Type, False, False, Get_Location (Assoc), Low, High); + Set_Individual_Association_Chain (Assoc, Chain); + if Dim < Nbr_Dims then + El := Chain; + while El /= Null_Iir loop + pragma Assert (Get_Kind (El) = Iir_Kind_Choice_By_Expression); + Finish_Individual_Assoc_Array_Subtype + (Get_Associated (El), Atype, Dim + 1); + El := Get_Chain (El); + end loop; + end if; end Finish_Individual_Assoc_Array_Subtype; procedure Finish_Individual_Assoc_Array @@ -687,7 +695,7 @@ package body Sem_Assocs is case Get_Kind (Atype) is when Iir_Kind_Array_Subtype_Definition => - Finish_Individual_Assoc_Array_Subtype (Assoc, Atype); + Finish_Individual_Assoc_Array_Subtype (Assoc, Atype, 1); when Iir_Kind_Array_Type_Definition => Atype := Create_Array_Subtype (Atype, Get_Location (Assoc)); Set_Index_Constraint_Flag (Atype, True); |