From acc257bbf0fe5cc6560d8fe1607d1be64528a96f Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Mon, 11 Jun 2018 09:17:45 +0000 Subject: [PATCH] [Ada] Unnesting: robustify analysis of block statements 2018-06-11 Ed Schonberg gcc/ada/ * exp_ch7.adb (Check_Unnesting_Elaboration_Code): Add guard. From-SVN: r261409 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/exp_ch7.adb | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d0722f772d8..b8a5ea4cbec 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2018-06-11 Ed Schonberg + + * exp_ch7.adb (Check_Unnesting_Elaboration_Code): Add guard. + 2018-06-11 Ed Schonberg * exp_unst.adb (Visit_Node): Skip generic associations. diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index c3707bb2eb8..663d9740bf6 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -4002,10 +4002,8 @@ package body Exp_Ch7 is then Stat := First (Statements (Handled_Statement_Sequence (N))); while Present (Stat) loop - if Nkind (Stat) = N_Block_Statement then - exit; - end if; - + exit when Nkind (Stat) = N_Block_Statement + and then Present (Identifier (Stat)); Next (Stat); end loop; @@ -4046,7 +4044,9 @@ package body Exp_Ch7 is First (Statements (Handled_Statement_Sequence (Elab_Body))); while Present (Stat) loop - if Nkind (Stat) = N_Block_Statement then + if Nkind (Stat) = N_Block_Statement + and then Present (Identifier (Stat)) + then Set_Scope (Entity (Identifier (Stat)), Elab_Proc); end if; -- 2.30.2