aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-08-25 20:25:51 +0200
committerTristan Gingold <tgingold@free.fr>2020-08-26 04:48:19 +0200
commitaf951f4502ee91f1230802f1fd62383017c76185 (patch)
treed70fff91d48ee5883b8107ebf3eea989a2e51859 /src/vhdl/translate
parent6a4eaa2208a9491fc0a12cbd994c6ffd858ffbb8 (diff)
downloadghdl-af951f4502ee91f1230802f1fd62383017c76185.tar.gz
ghdl-af951f4502ee91f1230802f1fd62383017c76185.tar.bz2
ghdl-af951f4502ee91f1230802f1fd62383017c76185.zip
trans-rtis: adjust max_depth of records. For #1404
Diffstat (limited to 'src/vhdl/translate')
-rw-r--r--src/vhdl/translate/trans-rtis.adb10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vhdl/translate/trans-rtis.adb b/src/vhdl/translate/trans-rtis.adb
index acd890548..3ca4b4a59 100644
--- a/src/vhdl/translate/trans-rtis.adb
+++ b/src/vhdl/translate/trans-rtis.adb
@@ -1630,9 +1630,8 @@ package body Trans.Rtis is
Push_Identifier_Prefix (Mark, Get_Identifier (El));
Type_Rti := Generate_Type_Definition (El_Type);
- Max_Depth :=
- Rti_Depth_Type'Max (Max_Depth,
- Get_Info (El_Type).B.Rti_Max_Depth);
+ Max_Depth := Rti_Depth_Type'Max
+ (Max_Depth, Get_Info (El_Type).B.Rti_Max_Depth);
case El_Tinfo.Type_Mode is
when Type_Mode_Unbounded_Array
@@ -1713,6 +1712,11 @@ package body Trans.Rtis is
else
Rtik := Ghdl_Rtik_Type_Unbounded_Record;
end if;
+
+ -- The layout variable may be deeper than the sub-elements (because
+ -- the record can be declared in a deeper scope).
+ Max_Depth := Rti_Depth_Type'Max (Max_Depth, Depth);
+
New_Record_Aggr_El
(Aggr, Generate_Common_Type
(Rtik, Depth, Max_Depth, Type_To_Mode (Atype)));