]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix internal error on case expression used as index of array component
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 28 May 2024 21:08:32 +0000 (23:08 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 21 Jun 2024 08:34:19 +0000 (10:34 +0200)
commitaa34d34f753cee8974af6942e0603dfc2f8ea160
tree697e194921ea100dd8ef70a4ec9e4fc3133b7b67
parent8c7ce88c00f9bea9fb6f7e466c8706439fb5b131
ada: Fix internal error on case expression used as index of array component

This occurs when the bounds of the array component depend on a discriminant
and the component reference is not nested, that is to say the component is
not (referenced as) a subcomponent of a larger record.

In this case, Analyze_Selected_Component does not build the actual subtype
for the component, but it turns out to be required for constructs generated
during the analysis of the case expression.

The change causes this actual subtype to be built, and also renames a local
variable used to hold the prefix of the selected component.

gcc/ada/

* sem_ch4.adb (Analyze_Selected_Component): Rename Name into Pref
and use Sel local variable consistently.
(Is_Simple_Indexed_Component): New predicate.
Call Is_Simple_Indexed_Component to determine whether to build an
actual subtype for the component.
gcc/ada/sem_ch4.adb