aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-12-12 18:07:43 +0100
committerTristan Gingold <tgingold@free.fr>2020-12-12 18:07:43 +0100
commit0363682d97c10b91c55ade1946a20fc4649e4423 (patch)
tree56f6564f517ce380367b6da0ad4365b80d40fb86 /src/synth
parentff0671f4962c01f5317902d2c7b88a2e6d585a54 (diff)
downloadghdl-0363682d97c10b91c55ade1946a20fc4649e4423.tar.gz
ghdl-0363682d97c10b91c55ade1946a20fc4649e4423.tar.bz2
ghdl-0363682d97c10b91c55ade1946a20fc4649e4423.zip
synth-expr: improve handling of null element in a record
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/synth-expr.adb6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index 742274ec4..90c4c59b6 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -2227,7 +2227,11 @@ package body Synth.Expr is
Val := Synth_Expression (Syn_Inst, Pfx);
Strip_Const (Val);
Res_Typ := Val.Typ.Rec.E (Idx + 1).Typ;
- if Is_Static (Val.Val) then
+ if Res_Typ.W = 0 and then Val.Val.Kind /= Value_Memory then
+ -- This is a null object. As nothing can be done about it,
+ -- returns 0.
+ return Create_Value_Memtyp (Create_Memory_Zero (Res_Typ));
+ elsif Is_Static (Val.Val) then
Res := Create_Value_Memory (Res_Typ);
Copy_Memory
(Res.Val.Mem, Val.Val.Mem + Val.Typ.Rec.E (Idx + 1).Moff,