[Ada] Do not indicate a pending abort if the task is already aborting

Message ID 20211109094620.GA830973@adacore.com
State Committed
Commit 09afdaeeeba7e4c1fd00f4c43b5e5b36dbe6cf92
Headers
Series [Ada] Do not indicate a pending abort if the task is already aborting |

Commit Message

Pierre-Marie de Rodat Nov. 9, 2021, 9:46 a.m. UTC
  Check_Abort_Status would return the equivalent of True while a task was
in the process of aborting causing another Abort exception to be raised
and not to terminate cleanly. This only affects targets that use stack
check emulation, which is currently limited to RTEMS.

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

gcc/ada/

	* libgnarl/s-tasini.adb (Check_Abort_Status): Don't return 1 if
	the task is aborting.
	* libgnarl/s-tasini.ads (Check_Abort_Status): Update comment.
  

Patch

diff --git a/gcc/ada/libgnarl/s-tasini.adb b/gcc/ada/libgnarl/s-tasini.adb
--- a/gcc/ada/libgnarl/s-tasini.adb
+++ b/gcc/ada/libgnarl/s-tasini.adb
@@ -126,6 +126,7 @@  package body System.Tasking.Initialization is
       if Self_ID /= null
         and then Self_ID.Deferral_Level = 0
         and then Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level
+        and then not Self_ID.Aborting
       then
          return 1;
       else


diff --git a/gcc/ada/libgnarl/s-tasini.ads b/gcc/ada/libgnarl/s-tasini.ads
--- a/gcc/ada/libgnarl/s-tasini.ads
+++ b/gcc/ada/libgnarl/s-tasini.ads
@@ -115,7 +115,7 @@  package System.Tasking.Initialization is
 
    function Check_Abort_Status return Integer;
    --  Returns Boolean'Pos (True) iff abort signal should raise
-   --  Standard'Abort_Signal. Only used by IRIX currently.
+   --  Standard'Abort_Signal. Only used by RTEMS currently.
 
    --------------------------
    -- Change Base Priority --