ada: Deep delta aggregates in postconditions
commit87517ca34eb1d65f33fd01e4e5e6fa900cb65f4b
authorSteve Baird <baird@adacore.com>
Wed, 1 Nov 2023 21:39:35 +0000 (1 14:39 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 21 Nov 2023 09:57:42 +0000 (21 10:57 +0100)
treecfa907b2f693d7300f72ee1ec3d7a57987bd1aad
parent3bf92fe3f2e4d6915ee6b9e9cb9cd9778a3386df
ada: Deep delta aggregates in postconditions

Fix a bug in handling array-valued deep delta aggregates occurring in
postconditions. The bug could result in a spurious compilation failure.

gcc/ada/

* sem_aggr.adb (Resolve_Delta_Array_Aggregate): In the case of a
deep delta choice, the expected type for the expression will
typically not be the component type of the array type, so a call
to Analyze_And_Resolve that assumes otherwise would be an error.
It turns out that such a call, while wrong, is usually harmless
because the expression has already been marked as analyzed. This
doesn't work if the aggregate occurs in a postcondition and, in
any case, we don't want to rely on this. So do not perform the
call in the deep case.
gcc/ada/sem_aggr.adb