Fortran: Allow VALUE on assumed-length CHARACTER dummies per F2008
Compiler now allows VALUE attribute on assumed-length CHARACTER dummies, per Fortran 2008.
Gfortran now supports the VALUE attribute for Fortran CHARACTER dummy arguments with assumed or non-constant lengths, conforming to the Fortran 2008 standard. Previously, the compiler enforced a stricter rule from the Fortran 2003 standard, rejecting these cases. The change involves relaxing length requirements for VALUE dummies and ensuring a caller-side copy is made, scaled appropriately by character kind size.
In Details
The compiler permits the VALUE attribute on Fortran CHARACTER dummy arguments with assumed-length or specified non-constant lengths, aligned with Fortran 2008 (C557). This relaxes the Fortran 2003 C528 restriction. The implementation ensures that these dummies are still passed by reference according to the ABI (byref=1), while conv_dummy_value creates a caller-side copy. The copy size is correctly scaled by the character kind's byte size.
- 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-length CHARACTER dummy
- A Fortran CHARACTER dummy argument whose length is not specified explicitly, taking its length from the corresponding actual argument.
- non-constant length
- In Fortran, a character dummy argument whose length is specified by another variable or dummy argument, rather than a constant integer.
- Fortran 2008
- An iteration of the Fortran programming language standard that introduced new features and relaxed some previous restrictions.
- gfortran
- The GNU Fortran compiler, part of the GCC suite.