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

Fix freezing of nested discriminated type

Fixes a compiler crash due to incorrect tree construction when freezing the base type of a nested discriminated type in Ada.

The Ada compiler crashed when unnesting the predicate function of a nested discriminated type due to an incorrect tree. The incorrect tree happened because the freeze node was being created for the base type of a discriminated type but without adjusting the scope and the visible declarations. This commit rectifies this by adjusting the freezing process, resolving the crash.

In Details

This commit fixes a compiler crash in sem_ch3.adb (specifically in Find_Type_Of_Object) when unnesting the predicate function of a nested discriminated type. The fix involves adjusting the freezing of the base type of a discriminated type by ensuring the scope and visible declarations are properly handled when creating the freeze node.

For Context

In Ada, a discriminated type is similar to a variant record in other languages. The type's structure can vary based on the value of a discriminant. "Freezing" a type is a compiler process where the compiler determines if an object can be modified. This commit fixes a bug where the freezing process was not correctly handling nested discriminated types, leading to a compiler crash.

Filed Under: adadiscriminated typecompiler crashbugfix