From 99ba07a3b0337454acc00e0a0bcf57ec9df73e80 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 19 Sep 2011 10:21:37 +0200 Subject: [multiple changes] 2011-09-19 Robert Dewar * sem_aggr.adb, lib-writ.ads, s-restri.ads, sem_ch6.adb, exp_aggr.adb: Minor reformatting. 2011-09-19 Yannick Moy * lib-xref.adb (Generate_Reference): Change entity referenced to underlying object if any, or else reference to the HEAP. From-SVN: r178956 --- gcc/ada/lib-xref.adb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gcc/ada/lib-xref.adb') diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index f16e8ab..e9de179 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -951,6 +951,33 @@ package body Lib.Xref is return; end if; + -- In Alfa mode, consider the underlying entity renamed instead of + -- the renaming, which is needed to compute a valid set of effects + -- (reads, writes) for the enclosing subprogram. + + if Alfa_Mode + and then Is_Object (Ent) + and then Present (Renamed_Object (Ent)) + then + Ent := Get_Enclosing_Object (Renamed_Object (Ent)); + + -- If no enclosing object, then it could be a reference to any + -- location not tracked individually, like heap-allocated data. + -- Conservatively approximate this possibility by generating a + -- dereference, and return. + + if No (Ent) then + if Actual_Typ = 'w' then + Alfa.Generate_Dereference (Nod, 'r'); + Alfa.Generate_Dereference (Nod, 'w'); + else + Alfa.Generate_Dereference (Nod, 'r'); + end if; + + return; + end if; + end if; + -- Record reference to entity Ref := Original_Location (Sloc (Nod)); -- cgit v1.1