diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-03-25 08:09:22 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-03-25 08:09:22 +0100 |
commit | 3c95998b5580765e1eb6466e3f525bb7f0693475 (patch) | |
tree | a3feb49e264f728f295f9cb484e17f302b630108 /src | |
parent | 7028d03e510297f383586e1da099205294f29b95 (diff) | |
download | ghdl-3c95998b5580765e1eb6466e3f525bb7f0693475.tar.gz ghdl-3c95998b5580765e1eb6466e3f525bb7f0693475.tar.bz2 ghdl-3c95998b5580765e1eb6466e3f525bb7f0693475.zip |
trans-chap6: add an explicit memory access during fat access deference
to catch NULL access
Diffstat (limited to 'src')
-rw-r--r-- | src/vhdl/translate/trans-chap6.adb | 10 |
1 files changed, 10 insertions, 0 deletions
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 |