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-or-terminate with No_Abort restrictions


Tested on x86-linux, committed on mainline.

When the restrictions No_Abort_Statements and
Max_Asynchronous_Select_Nesting => 0 are set, GNAT takes advantage of
these to generate simpler and more efficient code.
In the file term.adb, we were not handling properly some constructs such
as select-or-terminate.
term.adb should compile and run with no output, it used to
raise Program_Error.
--
pragma Restrictions (No_Abort_Statements);
pragma Restrictions (Max_Asynchronous_Select_Nesting => 0);
procedure Term is
  Bug : Boolean := False;
  task type Test_T is entry Wake_Up1; end;

  task body Test_T is
  begin
    select accept Wake_Up1; or terminate; end select;
    Bug := True;
  end;
  procedure Try is
    X : array (1..20) of Test_T;
  begin null; end;
begin
  Try;
  if Bug then raise Program_Error; end if;
end;

2005-01-03  Arnaud Charlet  <charlet@adacore.com>

	* s-tasini.ads, s-tasini.adb (Undefer_Abortion): Handle case of
	Self_Id.Deferral_Level = 0.
	(Do_Pending_Action): Move this function to the spec.

	* s-tasren.adb (Selective_Wait [Terminate_Selected]): Call
	Do_Pending_Action explicitely when needed, in case we're using
	No_Abort restrictions.

	* s-tassta.adb (Create_Task): If Abort is not allowed, reset the
	deferral level since it will not get changed by the generated code.
	Keeping a default value of 1 would prevent some operations (e.g.
	select or delay) to proceed successfully.

Attachment: difs.24
Description: Text document


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