diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-12-22 08:03:52 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-12-22 08:03:52 +0100 |
commit | 9f8627a01e41eb50e7e547f1d0da2ecc662da292 (patch) | |
tree | a27d5161cdc05d49968196f271d1c28d0c9c545c /src/vhdl/iirs_utils.adb | |
parent | d42d7795a70586f7479565b89e8870b25ceb06ba (diff) | |
download | ghdl-9f8627a01e41eb50e7e547f1d0da2ecc662da292.tar.gz ghdl-9f8627a01e41eb50e7e547f1d0da2ecc662da292.tar.bz2 ghdl-9f8627a01e41eb50e7e547f1d0da2ecc662da292.zip |
analysis: tolerate more parse errors (empty enumeration type).
Diffstat (limited to 'src/vhdl/iirs_utils.adb')
-rw-r--r-- | src/vhdl/iirs_utils.adb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/vhdl/iirs_utils.adb b/src/vhdl/iirs_utils.adb index bc4b7b7e7..6a888911d 100644 --- a/src/vhdl/iirs_utils.adb +++ b/src/vhdl/iirs_utils.adb @@ -774,18 +774,19 @@ package body Iirs_Utils is is Range_Expr : Iir_Range_Expression; Literal_List : constant Iir_Flist := Get_Enumeration_Literal_List (Def); + List_Len : constant Natural := Get_Nbr_Elements (Literal_List); begin -- Create a constraint. Range_Expr := Create_Iir (Iir_Kind_Range_Expression); Location_Copy (Range_Expr, Def); Set_Type (Range_Expr, Def); Set_Direction (Range_Expr, Iir_To); - Set_Left_Limit - (Range_Expr, - Get_Nth_Element (Literal_List, 0)); - Set_Right_Limit - (Range_Expr, - Get_Nth_Element (Literal_List, Get_Nbr_Elements (Literal_List) - 1)); + if List_Len >= 1 then + Set_Left_Limit + (Range_Expr, Get_Nth_Element (Literal_List, 0)); + Set_Right_Limit + (Range_Expr, Get_Nth_Element (Literal_List, List_Len - 1)); + end if; Set_Expr_Staticness (Range_Expr, Locally); Set_Range_Constraint (Def, Range_Expr); end Create_Range_Constraint_For_Enumeration_Type; |