aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_res.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-03-07 15:37:26 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2012-03-07 15:37:26 +0100
commitde94a7e7ff8664d90954bd93f60b5fa2a1b20422 (patch)
tree3453ccf0772d82d19afcfe1be5b4a5271b2ad0c8 /gcc/ada/sem_res.adb
parent0f2508394bbfae077f3e5d7ca05e93cabff06471 (diff)
downloadgcc-de94a7e7ff8664d90954bd93f60b5fa2a1b20422.zip
gcc-de94a7e7ff8664d90954bd93f60b5fa2a1b20422.tar.gz
gcc-de94a7e7ff8664d90954bd93f60b5fa2a1b20422.tar.bz2
[multiple changes]
2012-03-07 Thomas Quinot <quinot@adacore.com> * einfo.adb, einfo.ads: Add flag Reverse_Storage_Order. 2012-03-07 Yannick Moy <moy@adacore.com> * gnat_rm.texi, gnat_ugn.texi: Rewording of GNAT UG and GNAT RM to account for Ada 2012 assertions, and their pragma counterparts in GNAT. 2012-03-07 Thomas Quinot <quinot@adacore.com> * exp_attr.adb, sem_attr.adb: Minor reformatting. 2012-03-07 Bob Duff <duff@adacore.com> * hostparm.ads (Max_Instantiations): Increase parameter. 2012-03-07 Bob Duff <duff@adacore.com> * par-prag.adb: Minor code rearrangement. 2012-03-07 Bob Duff <duff@adacore.com> * a-strsup.ads, a-stwisu.ads, a-stzsup.ads (Super_String): Remove default initial value for Data. It is no longer needed because "=" now composes properly for untagged records. This default has caused efficiency problems. 2012-03-07 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Actuals): If the actual is a selected component of an anonymous access type, whose prefix is a variable, treat the variable as if it may be modified by the call, to suppress spurious warnings that a variable might be declared as a constant. From-SVN: r185049
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r--gcc/ada/sem_res.adb14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 1b2eef0..01fabab 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -3968,6 +3968,20 @@ package body Sem_Res is
Error_Msg_N
("invalid implicit conversion for access parameter", A);
end if;
+
+ -- If the actual is an access selected component of a variable,
+ -- the call may modify its designated object. It is reasonable
+ -- to treat this as a potential modification of the enclosing
+ -- record, to prevent spurious warnings that it should be
+ -- declared as a constant, because intuitively programmers
+ -- regard the designated subcomponent as part of the record.
+
+ if Nkind (A) = N_Selected_Component
+ and then Is_Entity_Name (Prefix (A))
+ and then not Is_Constant_Object (Entity (Prefix (A)))
+ then
+ Note_Possible_Modification (A, Sure => False);
+ end if;
end if;
-- Check bad case of atomic/volatile argument (RM C.6(12))