aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2014-01-24 14:51:19 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-01-24 15:51:19 +0100
commitad4e3362d3ea425d26c91c5a7d35a2649146bef9 (patch)
treeb7dba3998c295f3018673747616d89ddc6056caf /gcc
parentbff2d234281c10f137b8e2a2b9957c5675506eab (diff)
downloadgcc-ad4e3362d3ea425d26c91c5a7d35a2649146bef9.zip
gcc-ad4e3362d3ea425d26c91c5a7d35a2649146bef9.tar.gz
gcc-ad4e3362d3ea425d26c91c5a7d35a2649146bef9.tar.bz2
sem_ch3.adb (Analyze_Declarations): At the end of an appropriate declarative part...
2014-01-24 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Analyze_Declarations): At the end of an appropriate declarative part, call Freeze_All from the first declaration in the scope, not from the first unfrozen one. This is necessary to apply visibility checks to entities with delayed aspects. Otherwise, in the presence of instantiations and cleanups that they may generate, the delayed aspects may be analyzed too late and produce spurious visibility errors. * sem_attr.adb: Place etype on range. * sem_ch6.adb: Documentation expression functions. From-SVN: r207039
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/sem_attr.adb1
-rw-r--r--gcc/ada/sem_ch3.adb10
-rw-r--r--gcc/ada/sem_ch6.adb6
4 files changed, 26 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c1b5244..af31fea 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,15 @@
+2014-01-24 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Analyze_Declarations): At the end of an
+ appropriate declarative part, call Freeze_All from the first
+ declaration in the scope, not from the first unfrozen one. This
+ is necessary to apply visibility checks to entities with delayed
+ aspects. Otherwise, in the presence of instantiations and cleanups
+ that they may generate, the delayed aspects may be analyzed too
+ late and produce spurious visibility errors.
+ * sem_attr.adb: Place etype on range.
+ * sem_ch6.adb: Documentation expression functions.
+
2014-01-24 Robert Dewar <dewar@adacore.com>
* exp_ch7.adb: Minor change of Indices to Indexes (preferred
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 0325287..7db09d4 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -6117,6 +6117,7 @@ package body Sem_Attr is
(Low_Bound (Index), Etype (Index_Type));
Analyze_And_Resolve
(High_Bound (Index), Etype (Index_Type));
+ Set_Etype (Index, Etype (Index_Type));
else
Analyze_And_Resolve (Index, Etype (Index_Type));
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index c90be0c..cdfc062 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -2333,8 +2333,14 @@ package body Sem_Ch3 is
Freeze_From := First_Entity (Current_Scope);
end if;
+ -- There may have been several freezing points previously,
+ -- for example object declarations or subprogram bodies, but
+ -- at the end of a declarative part we check freezing from
+ -- the beginning, even though entities may already be frozen,
+ -- in order to perform visibility checks on delayed aspects.
+
Adjust_Decl;
- Freeze_All (Freeze_From, Decl);
+ Freeze_All (First_Entity (Current_Scope), Decl);
Freeze_From := Last_Entity (Current_Scope);
elsif Scope (Current_Scope) /= Standard_Standard
@@ -2348,7 +2354,7 @@ package body Sem_Ch3 is
or else Is_Empty_List (Private_Declarations (Parent (L)))
then
Adjust_Decl;
- Freeze_All (Freeze_From, Decl);
+ Freeze_All (First_Entity (Current_Scope), Decl);
Freeze_From := Last_Entity (Current_Scope);
end if;
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index edfaff2..ce3fcf4 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -435,7 +435,11 @@ package body Sem_Ch6 is
-- To prevent premature freeze action, insert the new body at the end
-- of the current declarations, or at the end of the package spec.
-- However, resolve usage names now, to prevent spurious visibility
- -- on later entities.
+ -- on later entities. Note that the function can now be called in
+ -- the current declarative part, which will appear to be prior to
+ -- the presence of the body in the code. There are nevertheless no
+ -- order of elaboration issues because all name resolution has taken
+ -- place at the point of declaration.
declare
Decls : List_Id := List_Containing (N);