]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sem_ch3.adb (Analyze_Declarations): At the end of an appropriate declarative part...
authorEd Schonberg <schonberg@adacore.com>
Fri, 24 Jan 2014 14:51:19 +0000 (14:51 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 24 Jan 2014 14:51:19 +0000 (15:51 +0100)
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

gcc/ada/ChangeLog
gcc/ada/sem_attr.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb

index c1b524456c08a19ef4971018bfdd0d91d6e5aee7..af31feaf69812ab36ee4d5ca806934920cb1209b 100644 (file)
@@ -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
index 032528738d8a8e5c210c0d9ab6c491fbb5326494..7db09d441f2815be14ecba3b4f28e34b06830963 100644 (file)
@@ -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));
index c90be0cc5022f01434aef1cf9d3b65fa21680870..cdfc062a5db31915a111dd4e9a8db9961cbd4bfe 100644 (file)
@@ -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;
 
index edfaff2b392b5b020fd202a4532d421c0d398a9a..ce3fcf4ca729fd4d15f291e3d8806c0a6e35d974 100644 (file)
@@ -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);