]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix crash on array component with nonstandard index type
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 11 Sep 2020 08:41:28 +0000 (10:41 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 11 Sep 2020 09:21:29 +0000 (11:21 +0200)
commitb3a51b99dbba2035723ccec69a8f0037f547bddf
treef6f3fc3c03061d01a712c0607b0ff2f2c050eff8
parent0679082b1db61603472aec2a1d704bbf25d64686
Fix crash on array component with nonstandard index type

This is a regression present on mainline, 10 and 9 branches: the compiler
goes into an infinite recursion eventually exhausting the stack for the
declaration of a discriminated record type with an array component having
a discriminant as bound and an index type that is an enumeration type with
a non-standard representation clause.

gcc/ada/ChangeLog:
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Only
create extra subtypes for discriminants if the RM size of the base
type of the index type is lower than that of the index type.

gcc/testsuite/ChangeLog:
* gnat.dg/specs/discr7.ads: New test.
gcc/ada/gcc-interface/decl.c
gcc/testsuite/gnat.dg/specs/discr7.ads [new file with mode: 0644]