aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-04-23 18:51:43 +0200
committerTristan Gingold <tgingold@free.fr>2021-04-23 18:52:37 +0200
commit386d5570b7a4c8e6c89f92a9ce6854d04df07bbe (patch)
treef130ec529beeccee74f131e02001dc1344e7a5b8 /src
parentd79fa58f7efc06a048adf9e2172792e64b8abb20 (diff)
downloadghdl-386d5570b7a4c8e6c89f92a9ce6854d04df07bbe.tar.gz
ghdl-386d5570b7a4c8e6c89f92a9ce6854d04df07bbe.tar.bz2
ghdl-386d5570b7a4c8e6c89f92a9ce6854d04df07bbe.zip
synth-insts.adb: avoid a crash after an error during instantiation. Fix #1734
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-decls.adb5
-rw-r--r--src/synth/synth-insts.adb5
2 files changed, 9 insertions, 1 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb
index 938860b0e..98485b6ff 100644
--- a/src/synth/synth-decls.adb
+++ b/src/synth/synth-decls.adb
@@ -792,10 +792,13 @@ package body Synth.Decls is
Val := Synth_Subtype_Conversion
(Ctxt, Val, Inter_Type, True, Assoc);
- if not Is_Static (Val.Val) then
+ if Val = No_Valtyp then
+ Set_Error (Sub_Inst);
+ elsif not Is_Static (Val.Val) then
Error_Msg_Synth
(+Assoc, "value of generic %i must be static", +Inter);
Val := No_Valtyp;
+ Set_Error (Sub_Inst);
end if;
Create_Object (Sub_Inst, Inter, Val);
diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb
index 228feef94..89340b255 100644
--- a/src/synth/synth-insts.adb
+++ b/src/synth/synth-insts.adb
@@ -1088,6 +1088,11 @@ package body Synth.Insts is
Get_Port_Chain (Ent),
Get_Port_Map_Aspect_Chain (Stmt));
+ if Is_Error (Sub_Inst) then
+ -- TODO: Free it?
+ return;
+ end if;
+
if Arch /= Null_Node then
-- For whiteboxes: append parameters or/and hash.
Enc := Name_Hash;