aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-vhdl_expr.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-04 19:45:56 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-04 19:45:56 +0100
commitf254978c5531b28d8b4f9a1d674b3465ec363b6e (patch)
tree6869a73da84085bef98e8421e97d8e5fa7332f2e /src/synth/synth-vhdl_expr.adb
parentb91a9fbbef7328f6f041f4ddda01dbbd7e156cfb (diff)
downloadghdl-f254978c5531b28d8b4f9a1d674b3465ec363b6e.tar.gz
ghdl-f254978c5531b28d8b4f9a1d674b3465ec363b6e.tar.bz2
ghdl-f254978c5531b28d8b4f9a1d674b3465ec363b6e.zip
synth: detect null access dereference, fix offset.
Diffstat (limited to 'src/synth/synth-vhdl_expr.adb')
-rw-r--r--src/synth/synth-vhdl_expr.adb8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb
index 49fa4a546..7cf295417 100644
--- a/src/synth/synth-vhdl_expr.adb
+++ b/src/synth/synth-vhdl_expr.adb
@@ -710,10 +710,16 @@ package body Synth.Vhdl_Expr is
| Iir_Kind_Dereference =>
declare
Val : Valtyp;
+ Acc : Heap_Index;
Obj : Memtyp;
begin
Val := Synth_Expression (Syn_Inst, Get_Prefix (Name));
- Obj := Elab.Vhdl_Heap.Synth_Dereference (Read_Access (Val));
+ Acc := Read_Access (Val);
+ if Acc = Null_Heap_Index then
+ Error_Msg_Synth (Syn_Inst, Name, "null access dereference");
+ return No_Valtyp;
+ end if;
+ Obj := Elab.Vhdl_Heap.Synth_Dereference (Acc);
return Create_Value_Memtyp (Obj);
end;
when others =>