diff options
author | Gary Dismukes <dismukes@adacore.com> | 2011-10-13 10:39:15 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-10-13 12:39:15 +0200 |
commit | 95aeda79481084e8b7f3900958236e331c7e1903 (patch) | |
tree | edfc743c58e19831d1b0256b949b3dcd247e3290 | |
parent | 200b7162a55a430b8fefedd5a0f9770cfb02a2e1 (diff) | |
download | gcc-95aeda79481084e8b7f3900958236e331c7e1903.zip gcc-95aeda79481084e8b7f3900958236e331c7e1903.tar.gz gcc-95aeda79481084e8b7f3900958236e331c7e1903.tar.bz2 |
exp_ch5.adb (Expand_N_Loop_Statement): For the transformation of a for loop for an enumeration type with an...
2011-10-13 Gary Dismukes <dismukes@adacore.com>
* exp_ch5.adb (Expand_N_Loop_Statement): For the transformation
of a for loop for an enumeration type with an enumeration rep
clause, which involves moving the original loop parameter into
a nested block, the loop parameter's entity must be removed from
the entity list of the loop scope.
From-SVN: r179904
-rw-r--r-- | gcc/ada/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ada/exp_ch5.adb | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 61da1c3..d6c30b3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2011-10-13 Gary Dismukes <dismukes@adacore.com> + + * exp_ch5.adb (Expand_N_Loop_Statement): For the transformation + of a for loop for an enumeration type with an enumeration rep + clause, which involves moving the original loop parameter into + a nested block, the loop parameter's entity must be removed from + the entity list of the loop scope. + 2011-10-13 Bob Duff <duff@adacore.com> * exp_ch6.ads (BIP_Storage_Pool): New "extra implicit parameter" diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 291d68e..75aa2a5 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -3458,6 +3458,20 @@ package body Exp_Ch5 is Statements => Statements (N)))), End_Label => End_Label (N))); + + -- The loop parameter's entity must be removed from the loop + -- scope's entity list, since itw will now be located in the + -- new block scope. Any other entities already associated with + -- the loop scope, such as the loop parameter's subtype, will + -- remain there. + + pragma Assert (First_Entity (Scope (Loop_Id)) = Loop_Id); + + Set_First_Entity (Scope (Loop_Id), Next_Entity (Loop_Id)); + if Last_Entity (Scope (Loop_Id)) = Loop_Id then + Set_Last_Entity (Scope (Loop_Id), Empty); + end if; + Analyze (N); -- Nothing to do with other cases of for loops |