with Text_IO;
procedure test1 is
   task type T1 is
      entry E1;
   end T1;

   task body T1 is
   begin
      Text_IO.Put_Line ("T1 started");
      accept E1;
      Text_IO.Put_Line ("T1 done");
   end T1;

   function f1 return T1 is
   begin
      return R : T1;
   end f1;

   procedure p2 (x1: T1) is
   begin
      Text_IO.Put_Line ("begin p2");
      x1.E1;
   end p2;

begin

   declare
     x1: T1 := f1;
   begin
     p2(x1);            -- this works
   end;

   declare
     x1: T1 renames f1;
   begin
     p2(x1);            -- this works
   end;

   p2(f1);              -- this hangs
end test1;


output:

begin p2
T1 started
T1 done
begin p2
T1 started
T1 done
begin p2
<<hangs>>


-- 
           Summary: Legal tasking program hangs at run time, function
                    returning task that is then passed to a subprogram
           Product: gcc
           Version: 4.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic at ludovic-brenta dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42413

Reply via email to