From 3c95998b5580765e1eb6466e3f525bb7f0693475 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 25 Mar 2022 08:09:22 +0100 Subject: trans-chap6: add an explicit memory access during fat access deference to catch NULL access --- src/vhdl/translate/trans-chap6.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/vhdl/translate/trans-chap6.adb b/src/vhdl/translate/trans-chap6.adb index e9e253126..9d8b6ccab 100644 --- a/src/vhdl/translate/trans-chap6.adb +++ b/src/vhdl/translate/trans-chap6.adb @@ -1207,11 +1207,21 @@ package body Trans.Chap6 is Pt_Info : constant Type_Info_Acc := Get_Info (Prefix_Type); Pfx : O_Enode; Pfx_Var : O_Dnode; + Chk_Null : O_Dnode; begin Pfx := Chap7.Translate_Expression (Prefix); if Pt_Info.Type_Mode = Type_Mode_Bounds_Acc then Pfx_Var := Create_Temp_Init (Pt_Info.Ortho_Type (Mode_Value), Pfx); + + -- Do a dummy memory access to catch null access. + Chk_Null := Create_Temp_Init + (Char_Type_Node, + New_Value (New_Access_Element + (New_Convert_Ov (New_Obj_Value (Pfx_Var), + Ghdl_Ptr_Type)))); + pragma Unreferenced (Chk_Null); + return Chap7.Bounds_Acc_To_Fat_Pointer (Pfx_Var, Prefix_Type); else -- cgit v1.2.3