GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Ada: Fix fallout of recent change to handling of static aggregates

Resolves issues with aggregate expansion for multi-dimensional arrays and constants.

This commit fixes two issues that emerged after recent changes to static aggregate handling in the Ada compiler. It corrects the duplication of elements in multi-dimensional array aggregates with ‘others’ choices and ensures that constants with static array aggregate values retain the correct dynamic subtype. The changes also refine the aggregate expansion machinery.

In Details

Recent modifications to aggregate handling in gcc/ada/exp_aggr.adb and sem_ch3.adb caused two issues: 1) Convert_To_Positional could excessively duplicate elements for 'others' clauses in multi-dimensional arrays, and 2) Analyze_Object_Declaration incorrectly left a dynamic subtype on constants whose values were static array aggregates. This commit adjusts Convert_To_Positional to correctly handle 'others' elements and modifies Analyze_Object_Declaration to propagate the expression's subtype to the object's subtype.

For Context
Static Aggregate
In Ada, an aggregate whose value is known at compile time. This allows for certain optimizations and use in contexts requiring compile-time constants.
Compile-time Known Aggregate
An internal flag used by the GCC Ada front-end to mark aggregates whose values and structure are fully determined during compilation.
Dynamic Actual Subtype
In Ada, the subtype of an object that can vary at runtime, often determined by discriminant values or other dynamic properties.
Filed Under: adacompiler bugfix