GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Ada: Fix handling of qualified subtype with static predicate in array aggregate.

The Ada compiler now correctly handles qualified subtypes with static predicates in array aggregates.

The Ada compiler now correctly handles static predicates associated with qualified subtypes used in array aggregates. Previously, the static predicate was ignored unless the choice in the aggregate was the direct name of the subtype. This ensures that the compiler correctly applies static predicates in array aggregates, leading to more accurate type checking and code generation.

In Details

The sem_aggr.adb file contains the Resolve_Array_Aggregate procedure, which handles semantic analysis of array aggregates. The bug was that the static predicate was being ignored when the choice in the aggregate was not the direct name of the subtype. This commit modifies Resolve_Array_Aggregate to analyze the choice before checking if it's a subtype with a predicate.

For Context

In Ada, a subtype is a type derived from another type with constraints on its values. A static predicate is a condition that must always be true for a subtype. An array aggregate is a way to initialize an array with specific values. This commit fixes a bug where the Ada compiler would incorrectly handle static predicates on subtypes used in array aggregates. The compiler now correctly checks the static predicate, ensuring that the array is initialized with valid values.

Filed Under: adasubtypespredicatesarray aggregatesbugfix