This is the mail archive of the 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] Default initialization of packed bit array with address clause

This change fixes a compiler crash occurring when a packed bit array object
has default initialization (because of a pragma Initialize_Scalars) and
an address clause. The crash was caused to the address clause causing
the object to have delayed freezing, with a freeze node occurring past
the call to the initialization procedure.

The following program must compile with no error (the warnings are
expected and legitimate):

$ gcc -c packed_bit_array_with_addr_clause.adb
packed_bit_array_with_addr_clause.adb:6:08: warning: default initialization of "GB" may modify "G"
packed_bit_array_with_addr_clause.adb:6:08: warning: use pragma Import for "GB" to suppress initialization (RM B.1(24))

pragma Initialize_Scalars;
procedure packed_bit_array_with_addr_clause (G : Integer) is
   type B32_T is array (0 .. 31) of Boolean;
   pragma Pack (B32_T);
   GB : B32_T;
   for GB use at G'Address;
end packed_bit_array_with_addr_clause;

Tested on x86_64-pc-linux-gnu, committed on trunk

2009-06-21  Thomas Quinot  <>

	* exp_ch3.adb, exp_prag.adb, exp_util.adb,, freeze.adb,
	sem_ch13.adb, sem_elab.adb (Exp_Prag.Expand_Pragma_Import_Or_Interface):
	Factor out code to new subprogram...
	(Exp_Util.Find_Init_Call): New shared routine to find the init proc call
	for a default initialized variable.
	(Freeze.Check_Address_Clause): Do not reset Has_Delayed_Freeze on an
	entity that has an associated freeze node.
	(Sem_Ch13.Analyze_Attribute_Definition_Clause, case Address):
	If there is an init call for the object, defer it to the object freeze
	(Check_Elab_Call.Find_Init_Call): Rename to Check_Init_Call, to avoid
	name clash with new subprogram introduced in Exp_Util.

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]