GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Ada GENERIC code streamlined for non-superflat discrete ranges.

Ada compiler improves GENERIC code generation for discrete ranges by better detecting the non-superflat case.

This Ada compiler update further streamlines the GENERIC code generation for non-superflat discrete ranges. It enhances the detection of this specific case, leading to more efficient generated code in common scenarios. The changes involve modifying helper functions and declarations related to range properties and type conversions within the GCC Ada front-end.

In Details

This patch refines the Ada front-end's handling of discrete ranges, specifically targeting the GENERIC code generation in the non-superflat case. It improves the range_cannot_be_superflat detection logic and its integration into type conversion routines (gnat_to_gnu_entity, get_type_length, Attribute_to_gnu). The goal is to optimize the emitted GENERIC code by more accurately identifying and leveraging the properties of discrete ranges that do not conform to the 'superflat' structure.

For Context
GENERIC
A mechanism in Ada that allows for the creation of reusable components (packages, subprograms) that operate on generic types or values. The compiler instantiates these components for specific types when they are used.
discrete range
In Ada, a range whose base type is an enumeration type or an integer type. It defines a contiguous sequence of values.
superflat
A term used in the context of Ada discrete ranges, likely referring to a specific structure or property that simplifies range representation and processing. Non-superflat implies a more complex or less optimized structure.
Filed Under: adaoptimizationcode generation