Bug 67837 - Ada ATC with delay abort syscalls not working
Summary: Ada ATC with delay abort syscalls not working
Status: CLOSED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 5.2.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-04 11:11 UTC by Nicolas Boulenguez
Modified: 2022-04-05 09:15 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Boulenguez 2015-10-04 11:11:24 UTC
As I understand the reference manual, the following program
  with Ada.Calendar; use Ada.Calendar;
  with Ada.Text_IO;  use Ada.Text_IO;
  with Interfaces.C; use Interfaces.C;
  procedure Main is
     function usleep (Secs : int) return int;
     pragma Import (C, usleep, "usleep");
     Res        : int;
     Start_Time : Time := Clock;
  begin
     select
        delay 1.0;
        Put_Line ("OK:" & Integer'Image (Integer (Clock - Start_Time)));
     then abort
        Res := usleep (10_000_000);
        Put_Line ("KO:" & Integer'Image (Integer (Clock - Start_Time)));
     end select;
  end Main;
should produce
  OK: 1
Instead, on amd64 with gnat-5.2.1-17:
  KO: 1
  OK: 1
and on mips with gnat-5.2.1-19:
  KO: 10
  OK: 10

The whole history can be found at https://bugs.debian.org/673772.
Comment 1 Arnaud Charlet 2015-10-04 15:10:01 UTC
Actually Ada does not make any guarantee when mixing ATC and system calls and
indeed, it is fundamentally unsafe if not impossible to properly abort from any random system call, so this isn't supported.
Comment 2 Nicolas Boulenguez 2022-04-05 09:15:17 UTC
The original author agrees to close this issue.