aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_util.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-10-07 14:24:31 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-07 14:24:31 +0200
commit2385e007496ef4abc4d978a644fbf3cd3f2a0094 (patch)
tree6cd2acd72a2a4954e6c1c0fce434c13e8a7e9ad2 /gcc/ada/exp_util.adb
parent0bfed5d4cd543a48e5826ef8eb7d4b39b2bbf94f (diff)
downloadgcc-2385e007496ef4abc4d978a644fbf3cd3f2a0094.zip
gcc-2385e007496ef4abc4d978a644fbf3cd3f2a0094.tar.gz
gcc-2385e007496ef4abc4d978a644fbf3cd3f2a0094.tar.bz2
[multiple changes]
2010-10-07 Robert Dewar <dewar@adacore.com> * scng.adb (Skip_Other_Format_Characters): New procedure (Start_Of_Wide_Character): New procedure (Scan): Use Start_Of_Wide_Character where appropriate (Scan): Improve error message for other_format chars in identifier (Scan): Allow other_format chars between tokens 2010-10-07 Javier Miranda <miranda@adacore.com> * exp_util.adb (Safe_Prefixed_Reference): When removing side effects, Add missing support for explicit dereferences. 2010-10-07 Robert Dewar <dewar@adacore.com> * par-ch10.adb, par-ch3.adb, par.adb: Minor reformatting. From-SVN: r165097
Diffstat (limited to 'gcc/ada/exp_util.adb')
-rw-r--r--gcc/ada/exp_util.adb19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index ae8a8e6..112fe04 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -4538,6 +4538,25 @@ package body Exp_Util is
or else Ekind (Entity (Prefix (N))) = E_In_Parameter;
end if;
+ -- If the prefix is an explicit dereference that is not access-to-
+ -- constant then this construct is a variable reference, which means
+ -- it is to be considered to have side effects if Variable_Ref is
+ -- True.
+
+ -- Exception is an access to an entity that is a constant or an
+ -- in-parameter.
+
+ elsif Nkind (Prefix (N)) = N_Explicit_Dereference
+ and then not Is_Access_Constant (Etype (Prefix (Prefix (N))))
+ and then Variable_Ref
+ then
+ declare
+ DDT : constant Entity_Id :=
+ Designated_Type (Etype (Prefix (Prefix (N))));
+ begin
+ return Ekind_In (DDT, E_Constant, E_In_Parameter);
+ end;
+
-- The following test is the simplest way of solving a complex
-- problem uncovered by BB08-010: Side effect on loop bound that
-- is a subcomponent of a global variable: