ada: Reject thin 'Unrestricted_Access value to aliased constrained array
commit593e08bd1ed37b588332fc6953dd94c1dbf5db51
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 5 Mar 2023 17:30:34 +0000 (5 18:30 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 26 May 2023 07:29:17 +0000 (26 09:29 +0200)
tree3dc1f7a016bbcf8ea24906da5b7f2064ea7d8da9
parentc7a07d7e6a09c43682576f625fc232a0ba3ee3ba
ada: Reject thin 'Unrestricted_Access value to aliased constrained array

This rejects the Unrestricted_Access attribute applied to an aliased array
with a constrained nominal subtype when its type is resolved to be a thin
pointer.  The reason is that supporting this case would require the aliased
array to contain its bounds, and this is the case only for aliased arrays
whose nominal subtype is unconstrained.

gcc/ada/

* sem_attr.adb (Is_Thin_Pointer_To_Unc_Array): New predicate.
(Resolve_Attribute): Apply the static matching legality rule to an
Unrestricted_Access attribute applied to an aliased prefix if the
type is a thin pointer.  Call Is_Thin_Pointer_To_Unc_Array for the
aliasing legality rule as well.
gcc/ada/sem_attr.adb