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 handling of select+function returning uncontrained array


Tested on i686-linux, committed on mainline.

Expressions that make use of the secondary stack, such as function calls
that return a controlled type or an unconstrained type, must be wrapped
in a short-lived block that includes the proper finalization actions.
If the expression is the actual in the entry_call_alternative of a select
construct, the finalization takes place after the select itself is
completed. This patch fixes an oversight: the previous code only checked
for timed entry calls, and not conditional entry calls.
Test case: the following must compile quietly.
--
procedure P is
   task T is
      entry E (S : String);
   end T;
   task body T is
   begin
      accept E (S: String);
   end;
   function F return String is begin return "hello"; end;
begin
   select
      T.E(F);
   else
      null;
   end select;
end;

2005-06-14  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch7.adb (Find_Node_To_Be_Wrapped): If the node appears within
	the entry_call alternative of a conditional entry call, wrap the
	conditional entry call itself.

Attachment: difs.22
Description: Text document


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