[Ada] Set missing Parent field of block entity

Message ID 20200716092051.GA146566@adacore.com
State New
Headers show
  • [Ada] Set missing Parent field of block entity
Related show

Commit Message

Pierre-Marie de Rodat July 16, 2020, 9:20 a.m.
This sets the Parent field of the block entity created in the case of
a statement sequence by Expand_N_Accept_Statement to the newly created
block statment, as done for example in Add_Block_Identifier.  This is
needed in peculiar cases where the block contains instantiations of
packages with generic child units.

No functional changes.

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


	* exp_ch9.adb (Expand_N_Accept_Statement): Set Parent of the
	created block entity to the created block statement.


diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -6660,6 +6660,7 @@  package body Exp_Ch9 is
          --  must be properly set.
          Set_Parent (Block, Parent (N));
+         Set_Parent (Blkent, Block);
          --  Prepend call to Accept_Call to main statement sequence If the
          --  accept has exception handlers, the statement sequence is wrapped