fortran: Diagnose allocatable PROCEDURE results early
Fortran compiler now diagnoses PROCEDURE and ALLOCATABLE result conflicts earlier for better diagnostics.
The Fortran compiler front-end now diagnoses conflicts between PROCEDURE and ALLOCATABLE attributes on function results before they are redirected to a hidden procedure pointer. This change ensures that attribute conflicts are checked against the original declaration, leading to more accurate and understandable diagnostics for developers.
In Details
In the Fortran frontend, when a function result is declared with PROCEDURE and ALLOCATABLE, the compiler previously allowed redirection to a hidden procedure pointer before checking for attribute conflicts. This commit moves the conflict check for PROCEDURE and ALLOCATABLE to occur prior to this redirection, ensuring that the diagnostics reflect the actual conflict in the user's source code rather than an artifact of the compiler's internal transformation.
- PROCEDURE statement
- In Fortran, a statement used to declare a procedure (function or subroutine) that can be passed as an argument or used as a type.
- allocatable
- In Fortran, an attribute for arrays or character strings that signifies their size can be determined and allocated at runtime.
- hidden procedure pointer
- An internal compiler construct used to manage procedure references, particularly when dealing with dynamic or complex function pointer scenarios.