From af951f4502ee91f1230802f1fd62383017c76185 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 25 Aug 2020 20:25:51 +0200 Subject: trans-rtis: adjust max_depth of records. For #1404 --- src/vhdl/translate/trans-rtis.adb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/vhdl/translate') 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))); -- cgit v1.2.3