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

Ada: Tweak freeze record type handling for derived types

Adjusts Ada freeze record type handling to ensure completion of primitive operations for types derived from untagged private types.

This commit refines the handling of freezing record types in the Ada compiler, specifically for types derived from untagged controlled private types. An early return in Expand_Freeze_Record_Type was found to be too late, preventing the proper completion of primitive operations for these derived types. The fix involves moving this early return to an earlier point in the function to ensure correct code generation.

In Details

In gcc/ada/exp_ch3.adb, the Expand_Freeze_Record_Type procedure is modified to correct the placement of an early return statement. This optimization, intended for types derived from untagged private types, was being executed too late in the code generation process, leaving declarations of primitive operations incomplete. Moving the return statement earlier ensures these operations are properly processed.

For Context
Freeze record type
A mechanism in Ada to finalize a record type, making it immutable and ensuring all its associated operations are complete.
Untagged controlled private type
An Ada type that is private (its internal structure is hidden) and not tagged (not polymorphic), but requires special handling for controlled operations (like initialization and finalization).
Primitive operations
Operations (like assignment, equality, initialization, finalization) that are fundamental to a type's behavior in Ada.
Filed Under: adacompilercode-generation