diff options
author | Patrick Bernardi <bernardi@adacore.com> | 2023-08-15 15:52:57 -0400 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-09-15 15:01:30 +0200 |
commit | 2578936b341585230d8554bb9c822c3d6f46f6ad (patch) | |
tree | 0adf9f0824b3f817409497e043f2abcc8c91a07c /gcc/ada/exp_ch6.adb | |
parent | 62e170e586d0822e7b92ca2f92df29d4b7b8e38b (diff) | |
download | gcc-2578936b341585230d8554bb9c822c3d6f46f6ad.zip gcc-2578936b341585230d8554bb9c822c3d6f46f6ad.tar.gz gcc-2578936b341585230d8554bb9c822c3d6f46f6ad.tar.bz2 |
ada: Do not perform local-exception-to-goto optimization on barrier functions
The local-exception-to-goto optimization is no longer applied to entry
barrier functions as entry barriers cannot contain exception handlers and
this optimization interferes with another optimization that occurs for
simple barrier functions.
In particular, the simple barrier optimization removes the push error label
statements generated by the local-exception-to-goto optimization. This
causes a Storage_Error in GIGI when the restriction No_Exception_Propagation
is active and a protected object contains more than one simple entry
barrier.
gcc/ada/
* exp_ch6.adb (Expand_N_Subprogram_Body): Do not perform
local-exception-to- goto optimization on barrier functions.
* exp_ch9.adb (Expand_Entry_Barrier): Simplify the if statement
around the simple barrier optimization and remove an old, no
longer relevant comment.
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index da1c9e6..a16dfe2 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -6008,16 +6008,18 @@ package body Exp_Ch6 is -- If local-exception-to-goto optimization active, insert dummy push -- statements at start, and dummy pop statements at end, but inhibit - -- this if we have No_Exception_Handlers, since they are useless and - -- interfere with analysis, e.g. by CodePeer. We also don't need these - -- if we're unnesting subprograms because the only purpose of these - -- nodes is to ensure we don't set a label in one subprogram and branch - -- to it in another. + -- this if we have No_Exception_Handlers or expanding a entry barrier + -- function, since they are useless and interfere with analysis (e.g. by + -- CodePeer) and other optimizations. We also don't need these if we're + -- unnesting subprograms because the only purpose of these nodes is to + -- ensure we don't set a label in one subprogram and branch to it in + -- another. if (Debug_Flag_Dot_G or else Restriction_Active (No_Exception_Propagation)) and then not Restriction_Active (No_Exception_Handlers) and then not CodePeer_Mode + and then not Is_Entry_Barrier_Function (N) and then not Unnest_Subprogram_Mode and then Is_Non_Empty_List (L) then |