Fortran: Allow VALUE attribute on array dummies per F2008
Fortran compiler now allows VALUE attribute on assumed-shape and explicit-shape array dummies.
Gfortran now permits the VALUE attribute on assumed-shape and explicit-shape array dummies, aligning with the Fortran 2008 standard. Previously, the compiler rejected these combinations, contrary to the relaxed rules. The change also refines error checking to distinguish between VALUE/DIMENSION and VALUE/CODIMENSION conflicts and ensures that VALUE array dummies are passed via a private deep copy.
In Details
The compiler's symbol resolution and type checking have been updated to allow the VALUE attribute on assumed-shape and explicit-shape array dummies, following Fortran 2008 (C557). Rejections are now specific to assumed-size arrays, BIND(C) procedure array dummies, and unimplemented polymorphic array dummies. The argument passing mechanism uses gfc_conv_subref_array_arg to create a private deep copy for VALUE array dummies, ensuring INTENT(IN) semantics and preventing modification of allocatable components.
- 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.
- assumed-shape array
- A Fortran array dummy argument whose size and shape are determined by the corresponding actual argument at runtime.
- explicit-shape array
- A Fortran array whose bounds are fixed and known at compile time.
- assumed-size array
- A Fortran array dummy argument whose upper bound is not specified, taking the size of the actual argument. This feature is largely superseded by assumed-shape arrays.
- BIND(C)
- An interoperability feature in Fortran that allows procedures and data to be called from or used with C code.
- gfortran
- The GNU Fortran compiler, part of the GCC suite.