https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123520

            Bug ID: 123520
           Summary: [Darwin] Master does not wait for dependent tasks
                    blocked on delay statement
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mjgardner at abitofhelp dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 63309
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63309&action=edit
MacOS and Win11 example projects. .adb has commented results in each project.

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.
  • [Bug ada/123520] New: [Darwin... mjgardner at abitofhelp dot com via Gcc-bugs

Reply via email to