aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate/trans-chap6.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-09-13 21:51:43 +0200
committerTristan Gingold <tgingold@free.fr>2021-09-14 04:16:51 +0200
commit77476d6ecc45f1761125524cbdeddfe74e3b157a (patch)
treef6107b185b8c92f28e99d129e839a0c28fbe211e /src/vhdl/translate/trans-chap6.adb
parent95cbcc921d92d58dbd25d328de60c18976083d2a (diff)
downloadghdl-77476d6ecc45f1761125524cbdeddfe74e3b157a.tar.gz
ghdl-77476d6ecc45f1761125524cbdeddfe74e3b157a.tar.bz2
ghdl-77476d6ecc45f1761125524cbdeddfe74e3b157a.zip
ortho: for slices, get element size from the result type
and not from the object type. Fix #1862
Diffstat (limited to 'src/vhdl/translate/trans-chap6.adb')
-rw-r--r--src/vhdl/translate/trans-chap6.adb12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/vhdl/translate/trans-chap6.adb b/src/vhdl/translate/trans-chap6.adb
index 1e5fe6bc2..1f4edde79 100644
--- a/src/vhdl/translate/trans-chap6.adb
+++ b/src/vhdl/translate/trans-chap6.adb
@@ -558,15 +558,14 @@ package body Trans.Chap6 is
-- Type of the first (and only) index of the prefix array type.
Index_Type : constant Iir := Get_Index_Type (Prefix_Type, 0);
- -- Element type.
- El_Type : constant Iir :=
- Chap3.Get_Element_Subtype_For_Info (Prefix_Type);
- El_Tinfo : constant Type_Info_Acc := Get_Info (El_Type);
-
-- Type of the slice.
Slice_Type : constant Iir := Get_Type (Expr);
Slice_Info : Type_Info_Acc;
+ -- Element type.
+ El_Type : Iir;
+ El_Tinfo : Type_Info_Acc;
+
-- Suffix of the slice (discrete range).
Expr_Range : constant Iir := Get_Suffix (Expr);
@@ -597,6 +596,9 @@ package body Trans.Chap6 is
Prefix_Var := Prefix;
+ El_Type := Chap3.Get_Element_Subtype_For_Info (Slice_Type);
+ El_Tinfo := Get_Info (El_Type);
+
if Is_Unbounded_Type (El_Tinfo) then
-- Copy layout of element before building the bounds
-- pragma Assert (Is_Unbounded_Type (Prefix_Info));