Fortran coarray accessors use variables instead of parameters
Dummy arguments in Fortran coarray accessor routines are changed from parameters to variables for correct handling.
This commit modifies the generated coarray accessor routines in Fortran to use FL_VARIABLE flavor for dummy arguments instead of FL_PARAMETER. This change ensures that these arguments are treated as modifiable variables, resolving issues where scalars were incorrectly processed by gfc_build_qualified_array and received unnecessary static tokens. The patterns in coarray_stat_function.f90 are also updated to accommodate these changes.
In Details
The coarray accessor routines in gfortran generated dummy arguments with FL_PARAMETER flavor, which implies a named constant. This commit changes this to FL_VARIABLE, treating them as modifiable. The __add_data dummy, a scalar coarray, was being passed through gfc_build_qualified_array due to this FL_VARIABLE change, leading to an unused static token. The fix prevents token creation if the declaration already has one. Test case coarray_stat_function.f90 is updated to accept any token and declaration number.
- Coarray
- A Fortran language feature that provides a way to express parallel programming. Coarrays allow direct access to data on remote processors as if it were local, with the runtime system handling the communication.
- dummy argument
- In Fortran, a variable name used in a procedure (function or subroutine) interface that receives a value from the actual argument passed during the procedure call.
- FL_PARAMETER
- A compiler internal flag indicating that a variable is a named constant (parameter).
- FL_VARIABLE
- A compiler internal flag indicating that a variable is a standard modifiable variable.