From: Arnaud Charlet Date: Tue, 9 Jul 2019 07:54:50 +0000 (+0000) Subject: [Ada] Disable calls to Abort defer/undefer when ZCX_By_Default X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0024315552cacb8cb38d913e1caa8506121654ef;p=gcc.git [Ada] Disable calls to Abort defer/undefer when ZCX_By_Default 2019-07-09 Arnaud Charlet gcc/ada/ * libgnat/s-memory.adb: Disable calls to Abort defer/undefer when ZCX_By_Default. From-SVN: r273284 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d8f7de624db..3832b31eaad 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-07-09 Arnaud Charlet + + * libgnat/s-memory.adb: Disable calls to Abort defer/undefer + when ZCX_By_Default. + 2019-07-09 Javier Miranda * sem_ch13.adb (Rep_Item_Too_Early): Representation clauses are diff --git a/gcc/ada/libgnat/s-memory.adb b/gcc/ada/libgnat/s-memory.adb index f34a92bb5f7..ebc168e912e 100644 --- a/gcc/ada/libgnat/s-memory.adb +++ b/gcc/ada/libgnat/s-memory.adb @@ -33,13 +33,10 @@ -- This implementation assumes that the underlying malloc/free/realloc -- implementation is thread safe, and thus, no additional lock is required. --- Note that we still need to defer abort because on most systems, an --- asynchronous signal (as used for implementing asynchronous abort of --- task) cannot safely be handled while malloc is executing. - --- If you are not using Ada constructs containing the "abort" keyword, then --- you can remove the calls to Abort_Defer.all and Abort_Undefer.all from --- this unit. +-- Note that when using sjlj exception handling, we still need to defer abort +-- because an asynchronous signal (as used for implementing asynchronous abort +-- of task on sjlj runtimes) cannot safely be handled while malloc is +-- executing. pragma Compiler_Unit_Warning; @@ -80,7 +77,7 @@ package body System.Memory is raise Storage_Error with "object too large"; end if; - if Parameters.No_Abort then + if ZCX_By_Default or else Parameters.No_Abort then Result := c_malloc (System.CRTL.size_t (Size)); else Abort_Defer.all; @@ -121,7 +118,7 @@ package body System.Memory is procedure Free (Ptr : System.Address) is begin - if Parameters.No_Abort then + if ZCX_By_Default or else Parameters.No_Abort then c_free (Ptr); else Abort_Defer.all; @@ -145,7 +142,7 @@ package body System.Memory is raise Storage_Error with "object too large"; end if; - if Parameters.No_Abort then + if ZCX_By_Default or else Parameters.No_Abort then Result := c_realloc (Ptr, System.CRTL.size_t (Size)); else Abort_Defer.all;