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] Concatenation and initialize_scalars


In certain contexts, a concatenation operation is expanded into an object
declaration followed by an assignment. The object declaration must not be
initialized when Initialize_Scalars is enabled.

The following must compile quietly:

pragma Initialize_Scalars;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
procedure P is

  type String_Access_T is access String;

  task type Task_T (Name : String_Access_T);

  task body Task_T is begin null; end;

  type Task_Access_T is access Task_T;

  procedure Nested (T_Name : Unbounded_String) is
    T_Ptr : Task_Access_T;
  begin
    T_Ptr := new Task_T (Name => new String'("." & To_String (T_Name)));
  end;

begin
  null;
end;

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

2010-06-21  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch4.adb (Expand_Concatenate): If an object declaration is created
	to hold the result, indicate that the target of the declaration does
	not need an initialization, to prevent spurious errors when
	Initialize_Scalars is enabled.

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]