This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Entity list of for loop for enumeration with rep gets truncated


When a for loop for an enumeration type with an enumeration representation
clause is expanded, it's rewritten as a loop over an integer loop parameter
and the original loop parameter is moved into a new nested block. When
the block is analyzed, the moved entity gets appended to the block scope's
entity list (as it should), but is left on the loop scope's entity list,
and no longer has a successor (because its Next_Entity is set to null). This
causes other entities on the loop to get lost from the loop's entity list.
The fix is to remove the loop parameter entity from the loop scope's list,
leaving any other declarations on that list intact (such as an itype for
the loop paramter's subtype). This problem surfaced when generating debugging
info with the GNAAMP compiler, due to encountering a loop parameter's itype
that was not found on any entity list.

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

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.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]