From 03d7679ae8d834bba4e175318ada25db33ef2944 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 11 Jan 2020 07:06:59 +0100 Subject: synth: fix crash on else-generate. Fix #1076 --- src/synth/synth-stmts.adb | 13 ++++++++++--- 1 file 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); -- cgit v1.2.3