From 366c04ab365cad2544fd39d3ce72e0f1c9ae1d29 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 25 Jun 2020 18:53:43 +0200 Subject: vhdl: avoid crash on error for -c/-r. --- src/ghdldrv/ghdlcomp.adb | 4 +++- src/vhdl/vhdl-configuration.adb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ghdldrv/ghdlcomp.adb b/src/ghdldrv/ghdlcomp.adb index 560a5ffd2..c58360aee 100644 --- a/src/ghdldrv/ghdlcomp.adb +++ b/src/ghdldrv/ghdlcomp.adb @@ -326,7 +326,9 @@ package body Ghdlcomp is Flags.Flag_Elaborate := True; Config := Vhdl.Configuration.Configure (Prim_Id, Sec_Id); - if Config = Null_Iir then + if Config = Null_Iir + or else Errorout.Nbr_Errors > 0 + then raise Compilation_Error; end if; diff --git a/src/vhdl/vhdl-configuration.adb b/src/vhdl/vhdl-configuration.adb index ad3fdc6a1..0f5c63b62 100644 --- a/src/vhdl/vhdl-configuration.adb +++ b/src/vhdl/vhdl-configuration.adb @@ -162,7 +162,9 @@ package body Vhdl.Configuration is Add_Design_Block_Configuration (Blk); Current_Configuration := Prev_Configuration; Arch := Strip_Denoting_Name (Get_Block_Specification (Blk)); - Add_Design_Unit (Get_Design_Unit (Arch), Loc); + if Arch /= Null_Iir then + Add_Design_Unit (Get_Design_Unit (Arch), Loc); + end if; end; when Iir_Kind_Architecture_Body => -- Add entity -- cgit v1.2.3