diff options
author | Gary Dismukes <dismukes@adacore.com> | 2024-08-12 22:50:57 +0000 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-08-29 15:06:26 +0200 |
commit | a383d7bb732a38649a46696a2c4386d825054050 (patch) | |
tree | 158d33247b142dff30dccef73539cffb0d8770d2 /gcc/tree-ssa-phiopt.cc | |
parent | 567e36ccbae11857413ab6cd7d50856173d16405 (diff) | |
download | gcc-a383d7bb732a38649a46696a2c4386d825054050.zip gcc-a383d7bb732a38649a46696a2c4386d825054050.tar.gz gcc-a383d7bb732a38649a46696a2c4386d825054050.tar.bz2 |
ada: Proper handling for iterator associations in array aggregates
The compiler was flagging type-mismatch errors on iterated component
associations in array aggregates of form "for C in <iterator_name>",
improperly requiring the type of the iterator to be the array index
type. The parser can't distinguish whether the association is one
involving an actual discrete choice vs. an iterator specification,
and creates an N_Iterated_Component_Association with a Defining_Identifer
and Discrete_Choices, and the analysis phase has to disambiguate this,
determining whether to create an N_Iterator_Specification node for
the association. A related change is to revise the similar code for
iterated associations of container aggregates, to allow forms of
iterator objects other than just function calls.
gcc/ada/
* sem_aggr.adb (Resolve_Array_Aggregate): Add loop over associations to locate
N_Iterated_Component_Associations that do not have an Iterator_Specification,
and if their Discrete_Choices list consists of a single choice, analyze it and
if it's the name of an iterator object, then create an Iterator_Specification
and associate it with the iterated component association.
(Resolve_Iterated_Association): Replace test for function call with test of
Is_Object_Reference, to handle other forms of iterator objects in container
aggregates.
Diffstat (limited to 'gcc/tree-ssa-phiopt.cc')
0 files changed, 0 insertions, 0 deletions