Fix parameterized string issues in Fortran.
Several Fortran compiler issues with parameterized derived types and strings are resolved.
This commit addresses multiple issues in the Fortran frontend related to parameterized derived types (PDTs) and strings. It ensures that PDT arrays with explicit array specifications are correctly handled, marks allocatable components with deferred types, and skips string length checks for PDT types. Additionally, it refines array referencing and memory allocation for PDT strings and arrays, and scalarizes PDT string arrays in the TRANSFER statement.
In Details
This commit fixes several bugs in the Fortran frontend's handling of Parameterized Derived Types (PDTs), specifically concerning strings and arrays. Changes include correctly identifying PDTs with explicit array specifications as PDT arrays, marking allocatable components of PDTs as deferred type, and skipping redundant string length checks for PDT types in resolve_structure_cons. Array referencing and structure allocation for PDT strings and arrays are improved by evaluating bounds and offsets and using strlen for memory allocation. PDT string arrays are now scalarized when used with `gf…
- 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.
- Allocatable
- A Fortran attribute that allows an array or derived type component to be dynamically allocated and deallocated during program execution.
- Deferred type
- A type parameter that is not fixed at compile time, such as the length of a deferred-length character string or the bounds of an allocatable array.
- Scalarized
- In the context of Fortran arrays, referring to treating an array element by element rather than as a whole structure.
- TRANSFER statement
- A Fortran statement used to transfer data between variables of different types or representations.