aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-01-11 07:06:59 +0100
committerTristan Gingold <tgingold@free.fr>2020-01-11 07:06:59 +0100
commit03d7679ae8d834bba4e175318ada25db33ef2944 (patch)
tree8cdad1c767f4e26d66c5c1b1db5678aec710bd1e
parent11a5be93a2b037dae7ba6785ea10cb17c7fef2b7 (diff)
downloadghdl-03d7679ae8d834bba4e175318ada25db33ef2944.tar.gz
ghdl-03d7679ae8d834bba4e175318ada25db33ef2944.tar.bz2
ghdl-03d7679ae8d834bba4e175318ada25db33ef2944.zip
synth: fix crash on else-generate. Fix #1076
-rw-r--r--src/synth/synth-stmts.adb13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb
index 5b5c6c2a2..964bc5d92 100644
--- a/src/synth/synth-stmts.adb
+++ b/src/synth/synth-stmts.adb
@@ -2859,15 +2859,22 @@ package body Synth.Stmts is
is
Gen : Node;
Bod : Node;
+ Icond : Node;
Cond : Value_Acc;
Name : Sname;
begin
Gen := Stmt;
Name := New_Sname_User (Get_Identifier (Stmt), Get_Sname (Syn_Inst));
loop
- Cond := Synth_Expression (Syn_Inst, Get_Condition (Gen));
- pragma Assert (Cond.Kind = Value_Discrete);
- if Cond.Scal = 1 then
+ Icond := Get_Condition (Gen);
+ if Icond /= Null_Node then
+ Cond := Synth_Expression (Syn_Inst, Icond);
+ pragma Assert (Cond.Kind = Value_Discrete);
+ else
+ -- It is the else generate.
+ Cond := null;
+ end if;
+ if Cond = null or else Cond.Scal = 1 then
Bod := Get_Generate_Statement_Body (Gen);
Apply_Block_Configuration
(Get_Generate_Block_Configuration (Bod), Bod);