Hello,

Can you please add this bug report to your system?

Thanks,
Mike

GCC Bugzilla Submission

URL: https://gcc.gnu.org/bugzilla/ (click "Enter a new bug report")

Component: ada

Version: 15.2.1

Summary: [Darwin] Master does not wait for dependent tasks blocked on delay
statement

Description: On macOS/Darwin, a master subprogram does not wait for its
dependent tasks to terminate when those tasks are blocked on a delay
statement. This violates ARM 9.3 which states the master cannot complete
until all dependent tasks have terminated.

The same code works correctly on Windows 11 with the same GNAT version.

Environment:

   -

   GNAT FSF 15.2.1 (via Alire)
   -

   GPRbuild 25.0.1
   -

   macOS Darwin 25.2.0 (Sequoia) - BUG
   -

   Windows 11 - WORKS CORRECTLY

Minimal reproducer:

  with Ada.Text_IO; use Ada.Text_IO;
  procedure Test is
     task T;
     task body T is
     begin
        for I in 1 .. 5 loop
           Put_Line ("hello from task");
           delay 1.0;
        end loop;
        Put_Line ("task done");
     end T;
  begin
     Put_Line ("main");
  end Test;

Expected behavior:

   -

   Program runs for ~5 seconds
   -

   Prints "hello from task" 5 times
   -

   Prints "task done"
   -

   Main waits at 'end Test' for task T to terminate

Actual behavior on macOS:

   -

   Program exits in ~0.3 seconds
   -

   Prints "hello from task" only 1 time
   -

   Never prints "task done"
   -

   Main does NOT wait for task T

Actual behavior on Windows:

   -

   Correct per Ada semantics

Workaround:

   -

   Use explicit entry/rendezvous synchronization

Note: If the delay statement is removed from the task body, macOS behaves
correctly. The bug only manifests when the task is blocked on a delay
statement at the time the master reaches its end.

_____________________________
Mike Gardner
Principal Software Engineer
A Bit of Help, Inc.
+1 602.810.8161
LinkedIn <https://www.linkedin.com/in/michaeljosephgardner/>
GitHub <https://github.com/abitofhelp>

Reply via email to