Fortran: Fix parameterized derived type errors related to string components.
Corrected GCC's Fortran compiler to handle errors in parameterized derived types with string components.
GCC’s Fortran compiler had issues correctly simplifying parameterized derived types (PDTs) when they contained string components. This commit modifies gfc_simplify_len in simplify.cc to return NULL for such components, resolving errors and ensuring proper handling of nested PDTs. A new test case, pdt_bug25.f90, has been added to verify the fix.
In Details
The Fortran frontend of GCC had a bug in gfc_simplify_len within gcc/fortran/simplify.cc related to parameterized derived types (PDTs). When a PDT contained parameterized string components, especially within nested PDTs, simplification failed. This patch corrects the behavior by returning NULL for such string components, aligning with the expected simplification logic and resolving PR fortran/82173.
- Fortran
- A high-level programming language primarily used for scientific and numerical computation.
- parameterized derived type (PDT)
- A Fortran derived type whose components or its own kind, length, or rank can be specified by parameters, allowing for more flexible and generic data structures.
- simplification
- In compilers, the process of reducing complex expressions or structures into simpler, equivalent forms. This is often a step in semantic analysis and optimization.
- string component
- A component within a derived type that has a character or string data type.