aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-09-18 07:31:00 +0200
committerTristan Gingold <tgingold@free.fr>2021-09-18 07:31:00 +0200
commit1fc3a1a33120307c75d8cc243e3a83c4d2cfb54c (patch)
tree2bf7db8fcfbd0ff9fab34a5b5c7242a9e47e81f4 /src/vhdl
parent968de84e5b389ee4b1f08c4ca4fb8492c387ee32 (diff)
downloadghdl-1fc3a1a33120307c75d8cc243e3a83c4d2cfb54c.tar.gz
ghdl-1fc3a1a33120307c75d8cc243e3a83c4d2cfb54c.tar.bz2
ghdl-1fc3a1a33120307c75d8cc243e3a83c4d2cfb54c.zip
trans-chap8: fix iteration on an enumeration type with only one literal.
Fix #1514
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/translate/trans-chap8.adb12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/vhdl/translate/trans-chap8.adb b/src/vhdl/translate/trans-chap8.adb
index 61da10c1d..582a526cd 100644
--- a/src/vhdl/translate/trans-chap8.adb
+++ b/src/vhdl/translate/trans-chap8.adb
@@ -418,12 +418,18 @@ package body Trans.Chap8 is
declare
List : constant Iir_Flist :=
Get_Enumeration_Literal_List (Base_Type);
+ Num : Natural;
begin
- -- FIXME: what about type E is ('T') ??
if Get_Nbr_Elements (List) = 1 then
- raise Internal_Error;
+ -- In the case of:
+ -- type E is ('T')
+ -- the iterator must have already finished. So it doesn't
+ -- matter if not incremented.
+ Num := 0;
+ else
+ Num := 1;
end if;
- V := New_Lit (Get_Ortho_Literal (Get_Nth_Element (List, 1)));
+ V := New_Lit (Get_Ortho_Literal (Get_Nth_Element (List, Num)));
end;
when others =>