From 0363682d97c10b91c55ade1946a20fc4649e4423 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 12 Dec 2020 18:07:43 +0100 Subject: synth-expr: improve handling of null element in a record --- src/synth/synth-expr.adb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/synth') 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, -- cgit v1.2.3