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 runtime assertion failure in timed selective wait


This change ensures fixes an improper usage of Defer_Abort where
Defer_Abort_Nestable is meant, that would cause a failed assrtion
if a timed selective accept statement occurs when there already is
a pending call to the accepted entry.

The following program must compile and execute quietly:

with Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;

procedure Call_Then_Accept is
   task Caller is
      entry Start;
   end Caller;

   task Callee is
      entry Start;
      entry With_Body;
   end Callee;

   task body Caller is
   begin
      accept Start do
         null;
      end Start;
      Callee.With_Body;
   end Caller;

   task body Callee is
      Called : Boolean := False;
   begin
      accept Start do
         null;
      end Start;
      select
         delay 10.0;
      or
         accept With_Body do
            Called := True;
         end With_Body;
      end select;
   exception
      when E : others =>
         Put_Line ("Callee: got " & Ada.Exceptions.Exception_Information (E));
   end Callee;

begin
   Caller.Start;
   delay 0.1;
   Callee.Start;
end Call_Then_Accept;

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

2011-10-13  Thomas Quinot  <quinot@adacore.com>

	* s-tasren.adb (Timed_Selective_Wait, case
	Accept_Alternative_Selected): Use Defer_Abort_Nestable, since
	we know abortion is already deferred.

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]