aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/elab-vhdl_objtypes.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-09-17 09:59:06 +0200
committerTristan Gingold <tgingold@free.fr>2022-09-17 09:59:06 +0200
commit1a0be9f1468ef003db9af51a3ac73d2f1e6ab61a (patch)
treec099ebdf77926b935945ed34bc18d0394eb2a7c6 /src/synth/elab-vhdl_objtypes.adb
parent432fc6fbf1a4d3ae9ec8a79d8adae93c07b6c3b9 (diff)
downloadghdl-1a0be9f1468ef003db9af51a3ac73d2f1e6ab61a.tar.gz
ghdl-1a0be9f1468ef003db9af51a3ac73d2f1e6ab61a.tar.bz2
ghdl-1a0be9f1468ef003db9af51a3ac73d2f1e6ab61a.zip
synth: handle incomplete types
Diffstat (limited to 'src/synth/elab-vhdl_objtypes.adb')
-rw-r--r--src/synth/elab-vhdl_objtypes.adb23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/synth/elab-vhdl_objtypes.adb b/src/synth/elab-vhdl_objtypes.adb
index 3662758d6..b027c84f1 100644
--- a/src/synth/elab-vhdl_objtypes.adb
+++ b/src/synth/elab-vhdl_objtypes.adb
@@ -631,7 +631,12 @@ package body Elab.Vhdl_Objtypes is
function Alloc is new Areapools.Alloc_On_Pool_Addr (Access_Type_Type);
Bnd_Sz : Size_Type;
begin
- Bnd_Sz := Compute_Size_Type (Acc_Type);
+ if Acc_Type = null then
+ -- For incomplete type.
+ Bnd_Sz := 0;
+ else
+ Bnd_Sz := Compute_Size_Type (Acc_Type);
+ end if;
return To_Type_Acc (Alloc (Current_Pool, (Kind => Type_Access,
Wkind => Wkind_Sim,
Al => 2,
@@ -642,6 +647,12 @@ package body Elab.Vhdl_Objtypes is
Acc_Bnd_Sz => Bnd_Sz)));
end Create_Access_Type;
+ procedure Complete_Access_Type (Acc_Type : Type_Acc; Des_Typ : Type_Acc) is
+ begin
+ Acc_Type.Acc_Acc := Des_Typ;
+ Acc_Type.Acc_Bnd_Sz := Compute_Size_Type (Des_Typ);
+ end Complete_Access_Type;
+
function Create_File_Type (File_Type : Type_Acc) return Type_Acc
is
subtype File_Type_Type is Type_Type (Type_File);
@@ -1039,7 +1050,12 @@ package body Elab.Vhdl_Objtypes is
Typ => Unshare (T.Rec.E (I).Typ, Pool));
end loop;
when Type_Access =>
- Res.Acc_Acc := Unshare (T.Acc_Acc, Pool);
+ if T.Acc_Acc /= null then
+ Res.Acc_Acc := Unshare (T.Acc_Acc, Pool);
+ else
+ -- For incomplete types
+ Res.Acc_Acc := null;
+ end if;
when Type_File =>
Res.File_Typ := Unshare (T.File_Typ, Pool);
when Type_Protected =>
@@ -1122,7 +1138,8 @@ package body Elab.Vhdl_Objtypes is
when Type_Bit
| Type_Logic
| Type_Discrete
- | Type_Float =>
+ | Type_Float
+ | Type_Access =>
Res := Typ;
return;
when others =>