aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-09-07 04:45:34 +0200
committerTristan Gingold <tgingold@free.fr>2022-09-07 04:45:34 +0200
commit100cd38bc4da75a5637fa221fd95cd2ae77bc56a (patch)
tree67b1f76898e1ff7349ab9814ce99a4817f423466 /src/synth
parentd23ad4452b1b8728fe546f25f97fe9a8bdcaf288 (diff)
downloadghdl-100cd38bc4da75a5637fa221fd95cd2ae77bc56a.tar.gz
ghdl-100cd38bc4da75a5637fa221fd95cd2ae77bc56a.tar.bz2
ghdl-100cd38bc4da75a5637fa221fd95cd2ae77bc56a.zip
elab-vhdl_heap: fix handling of simple access types
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/elab-vhdl_heap.adb21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/synth/elab-vhdl_heap.adb b/src/synth/elab-vhdl_heap.adb
index 60c215405..ed026a64e 100644
--- a/src/synth/elab-vhdl_heap.adb
+++ b/src/synth/elab-vhdl_heap.adb
@@ -48,15 +48,28 @@ package body Elab.Vhdl_Heap is
is
Typ_Sz : constant Size_Type := Acc_Typ.Acc_Bnd_Sz;
E : Heap_Entry;
- T : Type_Acc;
begin
pragma Assert (Acc_Typ.Kind = Type_Access);
E.Obj := Alloc_Mem (Obj_Typ.Sz);
- E.Typ := Alloc_Mem (Typ_Sz);
- T := Save_Type (Obj_Typ, E.Typ, Typ_Sz);
- pragma Unreferenced (T);
+ if Typ_Sz > 0 then
+ declare
+ T : Type_Acc;
+ begin
+ E.Typ := Alloc_Mem (Typ_Sz);
+ T := Save_Type (Obj_Typ, E.Typ, Typ_Sz);
+ pragma Unreferenced (T);
+ end;
+ else
+ declare
+ function To_Memory_Ptr is new Ada.Unchecked_Conversion
+ (Type_Acc, Memory_Ptr);
+ begin
+ E.Typ := To_Memory_Ptr (Obj_Typ);
+ end;
+ end if;
+
Res := E.Obj;
Heap_Table.Append (E);