aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-04-29 19:39:25 +0200
committerTristan Gingold <tgingold@free.fr>2022-04-29 19:39:25 +0200
commit399f99cb22ca3fc54f5b9adc85c0cabaae1328c4 (patch)
tree637bf02186db083198d85fefed68b6e58885706d
parent514762e26ffef8c8fc4167bb4d29a7de338893d8 (diff)
downloadghdl-399f99cb22ca3fc54f5b9adc85c0cabaae1328c4.tar.gz
ghdl-399f99cb22ca3fc54f5b9adc85c0cabaae1328c4.tar.bz2
ghdl-399f99cb22ca3fc54f5b9adc85c0cabaae1328c4.zip
synth: avoid a crash after an error
-rw-r--r--src/synth/synth-vhdl_expr.adb15
-rw-r--r--src/synth/synth-vhdl_static_proc.adb4
2 files changed, 19 insertions, 0 deletions
diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb
index 0ad0b4420..6036d6394 100644
--- a/src/synth/synth-vhdl_expr.adb
+++ b/src/synth/synth-vhdl_expr.adb
@@ -358,6 +358,21 @@ package body Synth.Vhdl_Expr is
Off, W, Vec, Vec_Off, Has_Zx);
exit when W = 0;
end loop;
+ when Type_Access =>
+ -- Accesses cannot be indexed or sliced.
+ -- Just fill with 'X'.
+ pragma Assert (Off = 0 and W >= Typ.W);
+ for I in 0 .. Typ.W - 1 loop
+ declare
+ Idx : constant Digit_Index := Digit_Index (Vec_Off / 32);
+ Pos : constant Natural := Natural (Vec_Off mod 32);
+ begin
+ Vec (Idx).Val := Vec (Idx).Val or Shift_Left (1, Pos);
+ Vec (Idx).Zx := Vec (Idx).Zx or Shift_Left (1, Pos);
+ end;
+ Vec_Off := Vec_Off + 1;
+ end loop;
+ W := W - Typ.W;
when others =>
raise Internal_Error;
end case;
diff --git a/src/synth/synth-vhdl_static_proc.adb b/src/synth/synth-vhdl_static_proc.adb
index 5dc31318b..0bdb785f0 100644
--- a/src/synth/synth-vhdl_static_proc.adb
+++ b/src/synth/synth-vhdl_static_proc.adb
@@ -32,6 +32,10 @@ package body Synth.Vhdl_Static_Proc is
Param : constant Valtyp := Get_Value (Syn_Inst, Inter);
Val : Heap_Index;
begin
+ if not Is_Static (Param.Val) then
+ -- Certainly an error (and certainly already reported).
+ return;
+ end if;
Val := Read_Access (Param);
if Val /= Null_Heap_Index then
Elab.Vhdl_Heap.Synth_Deallocate (Val);