diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-11-17 06:36:28 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-11-17 06:36:28 +0100 |
commit | 6c6a053898b751112e268907b164e970b0a6154e (patch) | |
tree | ed3bb10155bdb6221d44a7196c48cf8258b29bad /src/vhdl | |
parent | 092e6a9fe0272b1dd82083e4e7dff8ba859a463e (diff) | |
download | ghdl-6c6a053898b751112e268907b164e970b0a6154e.tar.gz ghdl-6c6a053898b751112e268907b164e970b0a6154e.tar.bz2 ghdl-6c6a053898b751112e268907b164e970b0a6154e.zip |
Fix incorrect analysis message on unbounded array.
For #459
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/sem_types.adb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/vhdl/sem_types.adb b/src/vhdl/sem_types.adb index aed9942cf..45f67be51 100644 --- a/src/vhdl/sem_types.adb +++ b/src/vhdl/sem_types.adb @@ -1498,16 +1498,22 @@ package body Sem_Types is -- array type with no index constraint applying to the index -- subtypes, or an access type whose designated type is such -- a type. - if Get_Kind (Type_Mark) = Iir_Kind_Array_Subtype_Definition - and then Get_Index_Constraint_Flag (Type_Mark) - then - Error_Msg_Sem (+Def, "constrained array cannot be re-constrained"); - end if; if Subtype_Index_List = Null_Iir_Flist then - -- Array is not constrained. - Set_Index_Constraint_Flag (Def, False); + -- Array is not constrained, but the type mark may already have + -- constrained on indexes. + if Get_Kind (Type_Mark) = Iir_Kind_Array_Subtype_Definition then + Set_Index_Constraint_Flag + (Def, Get_Index_Constraint_Flag (Type_Mark)); + else + Set_Index_Constraint_Flag (Def, False); + end if; Set_Index_Subtype_List (Def, Type_Index_List); else + if Get_Kind (Type_Mark) = Iir_Kind_Array_Subtype_Definition + and then Get_Index_Constraint_Flag (Type_Mark) + then + Error_Msg_Sem (+Def, "constrained array cannot be re-constrained"); + end if; Type_Nbr_Dim := Get_Nbr_Elements (Type_Index_List); Subtype_Nbr_Dim := Get_Nbr_Elements (Subtype_Index_List); |