aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-30 20:34:20 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-30 20:34:20 +0100
commit36f56bf6ec506072c19022de6a95055f3ededa99 (patch)
treea1e0479bf10f5a41c7aa01474b0e3a114d7a85f6
parent94372ab4200671b230fbc1d3386c5e206bda62d9 (diff)
downloadghdl-36f56bf6ec506072c19022de6a95055f3ededa99.tar.gz
ghdl-36f56bf6ec506072c19022de6a95055f3ededa99.tar.bz2
ghdl-36f56bf6ec506072c19022de6a95055f3ededa99.zip
synth: avoid a crash after errors in declarations. Fix #2334
-rw-r--r--src/synth/elab-vhdl_insts.adb46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/synth/elab-vhdl_insts.adb b/src/synth/elab-vhdl_insts.adb
index 283265dba..a397c6b95 100644
--- a/src/synth/elab-vhdl_insts.adb
+++ b/src/synth/elab-vhdl_insts.adb
@@ -697,7 +697,7 @@ package body Elab.Vhdl_Insts is
return;
end if;
- pragma Assert (Areapools.Is_Empty (Expr_Pool));
+ pragma Assert (Is_Expr_Pool_Empty);
Entity := Get_Entity (Arch);
Apply_Block_Configuration (Config, Arch);
@@ -705,29 +705,39 @@ package body Elab.Vhdl_Insts is
Elab.Vhdl_Files.Set_Design_Unit (Arch);
Elab_Declarations (Syn_Inst, Get_Declaration_Chain (Entity));
- Elab_Concurrent_Statements
- (Syn_Inst, Get_Concurrent_Statement_Chain (Entity));
-
- pragma Assert (Areapools.Is_Empty (Expr_Pool));
-
- Elab_Verification_Units (Syn_Inst, Entity);
-
- pragma Assert (Areapools.Is_Empty (Expr_Pool));
+ pragma Assert (Is_Expr_Pool_Empty);
- Elab_Declarations (Syn_Inst, Get_Declaration_Chain (Arch));
- pragma Assert (Areapools.Is_Empty (Expr_Pool));
- Elab_Concurrent_Statements
- (Syn_Inst, Get_Concurrent_Statement_Chain (Arch));
+ if not Is_Error (Syn_Inst) then
+ Elab_Concurrent_Statements
+ (Syn_Inst, Get_Concurrent_Statement_Chain (Entity));
+ pragma Assert (Is_Expr_Pool_Empty);
+ end if;
- pragma Assert (Areapools.Is_Empty (Expr_Pool));
+ if not Is_Error (Syn_Inst) then
+ Elab_Verification_Units (Syn_Inst, Entity);
+ pragma Assert (Is_Expr_Pool_Empty);
+ end if;
- Elab_Recurse_Instantiations (Syn_Inst, Arch);
+ if not Is_Error (Syn_Inst) then
+ Elab_Declarations (Syn_Inst, Get_Declaration_Chain (Arch));
+ pragma Assert (Is_Expr_Pool_Empty);
+ end if;
- pragma Assert (Areapools.Is_Empty (Expr_Pool));
+ if not Is_Error (Syn_Inst) then
+ Elab_Concurrent_Statements
+ (Syn_Inst, Get_Concurrent_Statement_Chain (Arch));
+ pragma Assert (Is_Expr_Pool_Empty);
+ end if;
- Elab_Verification_Units (Syn_Inst, Arch);
+ if not Is_Error (Syn_Inst) then
+ Elab_Recurse_Instantiations (Syn_Inst, Arch);
+ pragma Assert (Areapools.Is_Empty (Expr_Pool));
+ end if;
- pragma Assert (Areapools.Is_Empty (Expr_Pool));
+ if not Is_Error (Syn_Inst) then
+ Elab_Verification_Units (Syn_Inst, Arch);
+ pragma Assert (Areapools.Is_Empty (Expr_Pool));
+ end if;
end Elab_Instance_Body;
procedure Elab_Direct_Instantiation_Statement