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 anonymous access types


Tested on i686-linux, committed on trunk

Ada 2005 anonymous access types that appear in component and object
declarations require a master entity, just as named access types. If such
a type is a subcomponent of an array type with a pragma Pack,, it will be
examined twice: once during the expansion of the original type declaration,
and once during expansion of the generated declaration for the packed
array type. The master_id should not be created anew in the second case:
it is redundant, and the code assumes that the type declaration is part
of a list of declarations.
The following must compile quietly in Ada 2005 mode.
--
package Pack2 is
   type Rec is record
       Ptr: access Character;
       Int :Integer;
   end record;
--
   type Table is array (1..2) of rec;
   pragma Pack (Table);
end Pack2;

(pack2.ads added under testsuite/gnat.dg)

Other code clean ups to better support interfaces to task and protected objects.

2007-04-06  Ed Schonberg  <schonberg@adacore.com>
	    Javier Miranda  <miranda@adacore.com>

	* exp_ch3.ads, exp_ch3.adb (Analyze_N_Full_Type_Declaration): For an
	anonymous access component, do not create a master_id if type already
	has one, as may happen if the type is a subcomponent of a packed array
	type.
	(Build_Init_Procedure, Component_Needs_Simple_Initialization,
	Initialize_Tag): Remove code associated with the old CPP pragmas.
	CPP_Virtual and CPP_Vtable are no longer supported.
	(Build_Offset_To_Top_Internal): Add support for concurrent record types
	(Build_Offset_To_Top_Functions): Add support for concurrent record types
	(Freeze_Record_Type): Remove call to
	Init_Predefined_Interface_Primitives.
	(Init_Secondary_Tags.Initialize_Tag): New subprogram containing all the
	code required to initialize the tags of the secondary dispatch tables.
	This leaves the algoritm more clear.
	(Init_Secondary_Tags): Add support for concurrent record types
	(Make_Predefined_Primitive_Specs): Code cleanup.
	(Predefined_Primitive_Bodies): Code cleanup.
	(Build_Master_Renaming): New local subprogram.
	(Expand_N_Full_Type_Declaration): Build the master_id associated with
	anonymous access to task type components.
	(Expand_N_Subtype_Indication): The bounds of a range constraint in a
	subtype indication are resolved during analysis, and must not be done
	here.
	(Stream_Operation_OK): Check Restriction_Active before RTE_Available.

Attachment: difs
Description: Text document


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