This is the mail archive of the gcc-patches@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]

[Ada] fix bug in handling of visibility


Tested under i686-linux, commited on mainline.

If package P declares a private type T, and a child unit of P declares
ST as a subtype of T, then in the body the child unit ST is non-private
and its full view is available. The exchange of private and full views
of ST is done on entrance and exit from the compilation of the child
unit, by traversing the list of Private_Dependents of the parent type T.
If this traversal is done after exchanging the views of T itself on entry
to the package, on exit it must be done before the reverse exchange.
test case, must compile quietly:
--
package body Low_Level_Types.Operations is
   procedure Process_A (A : LL_Array_Abstraction) is begin null; end;
   procedure Process_I (I : LL_Integer_Abstraction) is begin null; end;
end;
package Low_Level_Types.Operations is
   procedure Process_A (A : LL_Array_Abstraction);
   procedure Process_I (I : LL_Integer_Abstraction);
end;
package Low_Level_Types is
   type LL_Array_Abstraction is private;
   type LL_Integer_Abstraction is private;
private
   type Array_Type is array (1 .. 4) of Character;
   type LL_Array_Abstraction is new Array_Type;
   type LL_Integer_Abstraction is new Integer;
end;
with User_Types; use User_types;
with Low_Level_Types.Operations;  use Low_Level_Types.Operations;
procedure User_Code is
   A : U_Array_Abstraction; I : U_Integer_Abstraction;
begin
   Process_I (I); Process_A (A);
end;
with Low_Level_Types;
package User_Types is
   subtype U_Array_Abstraction is Low_Level_Types.LL_Array_Abstraction;
   subtype U_Integer_Abstraction is Low_Level_Types.LL_Integer_Abstraction;
end;
--

2005-02-09  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch7.adb (Uninstall_Declarations): Exchange full and private
	views of a private type after handling its private dependents, to
	maintain proper stack discipline between entry and exit from the
	package.

Attachment: difs.16
Description: Text document


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