fortran: Dereference elements of span-addressed character arrays
Ensures correct dereferencing for span-addressed character arrays in Fortran.
This commit corrects an issue in the Fortran compiler where span-addressed character arrays were not always dereferenced, leading to type mismatches. The exception that omitted dereferencing when the pointer target type had the string flag set has been removed. This ensures that span-based pointer arithmetic accesses consistently result in the expected data type, preventing regressions when switching between different array access methods.
In Details
The gfc_build_spanned_array_ref function in trans.cc previously omitted pointer dereferencing for character arrays if the target type had the string flag set. This commit removes that exception, ensuring dereferencing always occurs. This resolves type discrepancies between regular array references and span-based pointer arithmetic, and removes redundant dereferencing logic in gfc_get_data_ptr_offset.
- span-addressed array
- An array in Fortran accessed using a starting address and an extent (span), often employed with pointers or dynamic arrays.
- dereference
- In pointer operations, dereferencing means accessing the value stored at the memory address pointed to by a pointer.
- string flag
- An internal flag in GCC's Fortran front-end that indicates a data type represents a character string.