Simplify Fortran PDT component initializers.
Fortran compiler simplifies initialization of KIND components in PDT templates.
This commit simplifies the initialization of KIND components within Parameterized Derived Type (PDT) templates in the Fortran compiler. It enforces that KIND components must be integer constants and ensures any remaining component initializers are simplified for parameter substitution if necessary. A new test case is added to verify these changes.
In Details
This change simplifies the initialization logic for KIND components within Fortran PDT templates in gcc/fortran/decl.cc. It ensures that initializers for KIND components are restricted to integer constants, as required by the Fortran standard. It also enhances the handling of other component initializers by attempting to simplify them for parameter substitution, if applicable. A new test case, pdt_94.f03, is added to the test suite to cover this functionality.
- Parameterized Derived Type (PDT)
- A derived type in Fortran whose components can have parameters, such as kind or length, that are determined at compile time or runtime.
- KIND type parameter
- A parameter in Fortran that specifies the intrinsic type of a data object, such as integer or real, and its precision or range.
- Integer constant
- A literal integer value used in Fortran code.
- Parameter substitution
- The process in Fortran where a named constant or parameter is replaced by its value during compilation.