aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/grt-rtis_addr.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-08-04 18:46:22 +0200
committerTristan Gingold <tgingold@free.fr>2020-08-04 18:46:22 +0200
commitc1f5f40de1a580ff708122b8f1a5e2f8d9e7cdc3 (patch)
tree21af9f1701f1a5f2b4c57802bc5a2dc7842f9634 /src/grt/grt-rtis_addr.adb
parent8d61edaf274ff80d2b185c0af34f30efa73d969a (diff)
downloadghdl-c1f5f40de1a580ff708122b8f1a5e2f8d9e7cdc3.tar.gz
ghdl-c1f5f40de1a580ff708122b8f1a5e2f8d9e7cdc3.tar.bz2
ghdl-c1f5f40de1a580ff708122b8f1a5e2f8d9e7cdc3.zip
grt: fix crash in --dump-rti for array of unbounded records.
For #1420
Diffstat (limited to 'src/grt/grt-rtis_addr.adb')
-rw-r--r--src/grt/grt-rtis_addr.adb20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/grt/grt-rtis_addr.adb b/src/grt/grt-rtis_addr.adb
index 4881a5abd..e02aa8e89 100644
--- a/src/grt/grt-rtis_addr.adb
+++ b/src/grt/grt-rtis_addr.adb
@@ -283,6 +283,26 @@ package body Grt.Rtis_Addr is
return Layout + Ghdl_Index_Type'(Ghdl_Indexes_Type'Size / 8);
end Array_Layout_To_Bounds;
+ function Array_Layout_To_Element
+ (Layout : Address; El_Rti : Ghdl_Rti_Access) return Address is
+ begin
+ case El_Rti.Kind is
+ when Ghdl_Rtik_Type_Array
+ | Ghdl_Rtik_Subtype_Array
+ | Ghdl_Rtik_Subtype_Unbounded_Array =>
+ -- Trim size to pass the bounds
+ return Array_Layout_To_Bounds (Layout);
+ when Ghdl_Rtik_Type_Unbounded_Record
+ | Ghdl_Rtik_Subtype_Unbounded_Record =>
+ -- Keep full layout.
+ return Layout;
+ when Ghdl_Rtik_Type_Record =>
+ return Null_Address;
+ when others =>
+ return Null_Address;
+ end case;
+ end Array_Layout_To_Element;
+
procedure Bound_To_Range (Bounds_Addr : Address;
Def : Ghdl_Rtin_Type_Array_Acc;
Res : out Ghdl_Range_Array)