aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-10-26 12:31:06 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-10-26 12:31:06 +0100
commit24fd21c393d671989c45f53fcfb0f489d9ca768e (patch)
tree0f9950631aa45cfa54c57c97b5eed3b4ebc9d641 /gcc/ada/sem_util.adb
parent529ce461f0ec3b81458e8478a1342e7a89a43861 (diff)
downloadgcc-24fd21c393d671989c45f53fcfb0f489d9ca768e.zip
gcc-24fd21c393d671989c45f53fcfb0f489d9ca768e.tar.gz
gcc-24fd21c393d671989c45f53fcfb0f489d9ca768e.tar.bz2
[multiple changes]
2015-10-26 Yannick Moy <moy@adacore.com> * lib-xref-spark_specific.adb (Add_SPARK_Xrefs): Use character 'r' to denote a reference to a constant which may have variable input, and thus may be treated as a variable in GNATprove, instead of the character 'c' used for constants. 2015-10-26 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Object_Access_Level): Only aliased formals of functions have the accessibility level of the point of call; aliased formals of procedures have the same level as unaliased formals. (New_Copy_Tree): Add guard on copying itypes. From code reading. From-SVN: r229337
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 2332bb3..464619a 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -15330,7 +15330,10 @@ package body Sem_Util is
while Present (Elmt) loop
Next_Elmt (Elmt);
New_Itype := Node (Elmt);
- Copy_Itype_With_Replacement (New_Itype);
+
+ if Is_Itype (New_Itype) then
+ Copy_Itype_With_Replacement (New_Itype);
+ end if;
Next_Elmt (Elmt);
end loop;
end;
@@ -16041,10 +16044,15 @@ package body Sem_Util is
return Type_Access_Level (Scope (E)) + 1;
else
- -- Aliased formals take their access level from the point of call.
- -- This is smaller than the level of the subprogram itself.
-
- if Is_Formal (E) and then Is_Aliased (E) then
+ -- Aliased formals of functions take their access level from the
+ -- point of call, i.e. require a dynamic check. For static check
+ -- purposes, this is smaller than the level of the subprogram
+ -- itself. For procedures the aliased makes no difference.
+
+ if Is_Formal (E)
+ and then Is_Aliased (E)
+ and then Ekind (Scope (E)) = E_Function
+ then
return Type_Access_Level (Etype (E));
else