[Ada] Spurious dimensionality error on aggregate with "others" assoc.
authorEd Schonberg <schonberg@adacore.com>
Thu, 4 Jul 2019 08:05:03 +0000 (08:05 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 4 Jul 2019 08:05:03 +0000 (08:05 +0000)
commitdcd59a994affdd191d7025269b18a1043f80a47f
treec4d4b85eb61b80dc45905445311c72dce2f31268
parentee7904e91fcdafd4211f89e0244354467d78a3c2
[Ada] Spurious dimensionality error on aggregate with "others" assoc.

This patch fixes a spurious dimensionality error on an array aggregate
with a single "others' clause whose expression is a dimensioned entity,
The expansion of the aggregate may create copies of the expression, and
the dimensionality check must use the type of the expression to retrieve
the proper dimension information to check against the dimensions of the
array component type.

2019-07-04  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_dim.adb (Analyze_Dimension_Array_Aggregate): If the
component is an entity name, its dimensions are those of its
type.

gcc/testsuite/

* gnat.dg/dimensions2.adb, gnat.dg/dimensions2_phys.ads,
gnat.dg/dimensions2_real_numbers.ads: New testcase.

From-SVN: r273043
gcc/ada/ChangeLog
gcc/ada/sem_dim.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/dimensions2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/dimensions2_phys.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/dimensions2_real_numbers.ads [new file with mode: 0644]