]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Support fixed-lower-bound array types as generic actual parameters
authorGary Dismukes <dismukes@adacore.com>
Mon, 17 Mar 2025 18:30:00 +0000 (18:30 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 9 Jun 2025 06:32:14 +0000 (08:32 +0200)
commit4e96f7fc8e1997e55dc7bd47d59b33b6010a892f
treebf2bd313388e89195afa02b2775fb1ee031c2c3b
parent4631b74b97fbe0e411fe60a1cc0f8432c4eb694e
ada: Support fixed-lower-bound array types as generic actual parameters

Attempting to use a fixed-lower-bound array type (or subtype) as
an actual parameter for a formal unconstrained array type was being
rejected by the compiler (complaining about the index type of the
actual not matching the index type of the formal type).  The compiler
was improperly testing the actual's FLB range and finding that it didn't
statically match the index type of the formal array type; it should
instead test the underlying index type of the FLB type or subtype.

gcc/ada/ChangeLog:

* sem_ch3.adb (Constrain_Index): In the case of a fixed-lower-bound index,
set Etype of the newly created itype's Scalar_Range from the index's Etype.
* sem_ch12.adb (Validate_Array_Type_Instance): If the actual subtype is
a fixed-lower-bound type, then check again the Etype of its Scalar_Range.
gcc/ada/sem_ch12.adb
gcc/ada/sem_ch3.adb