Fortran enforces restrictions on polymorphic volatile array arguments
Fortran compiler now correctly checks restrictions on polymorphic volatile array arguments.
The Fortran compiler now correctly enforces restrictions on polymorphic volatile array arguments. Previously, checks for forbidden cases involving polymorphic arrays were insufficient. This change updates the comparison logic to correctly identify and reject invalid arguments, ensuring stricter adherence to language standards.
In Details
The fortran/interface.cc compare_parameter function previously had incomplete checks for VOLATILE and ASYNCHRONOUS array arguments when the dummy argument was polymorphic. This commit updates the checks to use CLASS_DATA, ensuring the correct attributes and fields are examined for polymorphic dummies, aligning with language rules.
- polymorphic
- In Fortran, a polymorphic entity can have dynamic type, meaning its type can change during execution. This allows for more flexible programming, particularly with inheritance and dynamic dispatch.
- volatile
- The VOLATILE attribute in Fortran specifies that a variable's value may be altered by external means (e.g., hardware or another process) at any time. The compiler must not optimize away accesses to volatile variables.
- CLASS_DATA
- A macro or internal representation used in the Fortran front-end to access data members of polymorphic variables, ensuring correct handling of dynamic typing.