Ada dynamic concatenation lower bound computation streamlined.
Ada compiler streamlines lower bound calculation for dynamic concatenation, simplifying generated code.
This Ada compiler change streamlines the computation of the lower bound for dynamic concatenation. It removes redundant checks when the result may be null and the array type originates from an unconstrained definition. By introducing a local constant for the result’s first subtype and adjusting guarding conditions, the generated code for these concatenations is significantly simplified, especially in cases involving unconstrained arrays and slices.
In Details
This patch refactors the Expand_Concatenate procedure in exp_ch4.adb for the Ada front-end. It streamlines the lower bound computation for dynamic concatenations involving potentially null results and array types derived from unconstrained definitions. The change introduces a Rtyp local constant representing the root type's first subtype and removes redundant non-null checks for the lower bound expression when Rtyp is unconstrained. It also corrects guarding for slice usage in bounded dynamic concatenations.
- dynamic concatenation
- In Ada, combining strings or arrays at runtime where the size is not known at compile time.
- lower bound
- The minimum index value of an array or range.
- unconstrained array
- An array type whose index ranges are not specified at the time of type definition; their bounds are determined by the specific object's declaration.