[Ada] Unnesting: do not generate push/pop for exceptions

2018-05-29  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* exp_ch6.adb (Expand_N_Subprogram_Body): Do not generate push/pop for
	exceptions if subprogram unnesting is in effect, because these branch
	nodes are relevant only in the presence of nested subprograms.

From-SVN: r260883
This commit is contained in:
Ed Schonberg 2018-05-29 09:42:11 +00:00 committed by Pierre-Marie de Rodat
parent ef22a3b269
commit 3747db827d
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-05-29 Ed Schonberg <schonberg@adacore.com>
* exp_ch6.adb (Expand_N_Subprogram_Body): Do not generate push/pop for
exceptions if subprogram unnesting is in effect, because these branch
nodes are relevant only in the presence of nested subprograms.
2018-05-29 Ed Schonberg <schonberg@adacore.com>
* libgnat/s-fatgen.adb (Succ, Pred): Raise Constraint_Error

View File

@ -5664,12 +5664,16 @@ 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
-- intefere with analysis, e.g. by codepeer.
-- 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.
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 Unnest_Subprogram_Mode
and then Is_Non_Empty_List (L)
then
declare