aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-oper.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-11 07:42:28 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-11 07:42:28 +0200
commitce8abff2b16f3661573a931c2318ba7520926df8 (patch)
treee86b2f896ead7bf5154ea36efbaf2add434a9351 /src/synth/synth-oper.adb
parent95ed6e48350f612583da1a1cff90c0b64b2e1f76 (diff)
downloadghdl-ce8abff2b16f3661573a931c2318ba7520926df8.tar.gz
ghdl-ce8abff2b16f3661573a931c2318ba7520926df8.tar.bz2
ghdl-ce8abff2b16f3661573a931c2318ba7520926df8.zip
synth-oper: avoid a crash in case of error.
Diffstat (limited to 'src/synth/synth-oper.adb')
-rw-r--r--src/synth/synth-oper.adb32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb
index 79f5ea743..b66f7dda3 100644
--- a/src/synth/synth-oper.adb
+++ b/src/synth/synth-oper.adb
@@ -1646,21 +1646,25 @@ package body Synth.Oper is
Synth_Subprogram_Association
(Subprg_Inst, Syn_Inst, Inter_Chain, Assoc_Chain);
- -- If all operands are static, handle the call differently.
- Static := True;
- Inter := Inter_Chain;
- while Inter /= Null_Node loop
- if not Is_Static (Get_Value (Subprg_Inst, Inter).Val) then
- Static := False;
- exit;
- end if;
- Inter := Get_Chain (Inter);
- end loop;
-
- if Static then
- Res := Synth_Static_Predefined_Function_Call (Subprg_Inst, Expr);
+ if Is_Error (Subprg_Inst) then
+ Res := No_Valtyp;
else
- Res := Synth_Dynamic_Predefined_Function_Call (Subprg_Inst, Expr);
+ -- If all operands are static, handle the call differently.
+ Static := True;
+ Inter := Inter_Chain;
+ while Inter /= Null_Node loop
+ if not Is_Static (Get_Value (Subprg_Inst, Inter).Val) then
+ Static := False;
+ exit;
+ end if;
+ Inter := Get_Chain (Inter);
+ end loop;
+
+ if Static then
+ Res := Synth_Static_Predefined_Function_Call (Subprg_Inst, Expr);
+ else
+ Res := Synth_Dynamic_Predefined_Function_Call (Subprg_Inst, Expr);
+ end if;
end if;
Free_Instance (Subprg_Inst);