Fortran: Support scalar actual argument with VALUE array dummy
Enables sequence association for scalar actual arguments passed to VALUE array dummies.
Gfortran now correctly handles sequence association when a scalar actual argument is passed to a Fortran dummy argument that is an explicit-shape array with the VALUE attribute. Previously, this scenario led to an ICE because the compiler’s handling for scalar VALUE dummies did not extend to array dummies. The fix involves creating temporary copies of array elements and managing character string lengths appropriately.
In Details
The compiler now supports sequence association for scalar actual arguments passed to VALUE array dummies. This resolves an ICE that occurred because conv_dummy_value only handled scalar dummies. The new conv_seq_assoc_value_arg function copies elements into a temporary based on the dummy's bounds, evaluating them via an interface mapping. For CHARACTER dummies, hidden length arguments are preserved.
- sequence association
- In Fortran, a mechanism where a scalar actual argument can be associated with an array dummy argument, providing access to the array's elements sequentially.
- VALUE attribute
- In Fortran, when applied to a dummy argument, this attribute specifies that the argument is passed by value, meaning a private copy is made for the procedure. Changes within the procedure do not affect the actual argument.
- explicit-shape array
- A Fortran array whose bounds are fixed and known at compile time.
- ICE
- Internal Compiler Error. A crash within the compiler itself, typically due to an unexpected internal state or logic error.
- gfortran
- The GNU Fortran compiler, part of the GCC suite.