This is the mail archive of the gcc-cvs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

r260516 - in /trunk/gcc/ada: ChangeLog freeze.adb


Author: pmderodat
Date: Tue May 22 13:22:58 2018
New Revision: 260516

URL: https://gcc.gnu.org/viewcvs?rev=260516&root=gcc&view=rev
Log:
[Ada] Spurious visibility error on aspect in generic unit

This patch fixes a spurious visiblity error on an instantiation of a generic
package that contains a type declaration with an aspect specification for
an aspect that must be delayed (i.e. an aspect whose value may be specified
at a later point).

The package g.ads must compile quietly:

----
with S;
generic
package G
is
   type Buffer_Type is record
      Data       : Integer;
   end record;

   package Buffer is new S (Buffer_Type => Buffer_Type);
end G;
----
generic
   type Buffer_Type is private;
package S
is
   Page_Size : constant := 4096;

   type Reader_Type is limited record
      Data   : Buffer_Type;
   end record
     with
        Alignment => Page_Size; -- Using a constant does not work
--      Alignment => 4096;      -- Using a number works

-- for Reader_Type'Alignment use Page_Size; -- so does an attribute.
   pragma Compile_Time_Error (Reader_Type'Size /= 12345, "Ooops");
   -- Note: We set 'Alignment and check for 'Size.
end S;

2018-05-22  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* freeze.adb (Freeze_Entity): When analyzing delayed aspects of an
	entity E within a generic unit, indicate that there are no remaining
	delayed aspects after invoking Analyze_Aspects_At_Freeze_Point. The
	entity E is not frozen yet but the aspects should not be reanalyzed at
	the freeze point, which may be outside of the generic and may not have
	the proper visibility.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/freeze.adb


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]