[Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures

anlauf at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Oct 24 21:00:02 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491

--- Comment #2 from anlauf at gcc dot gnu.org ---
The patch

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index a210f9aad43..096108f4317 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -16476,6 +16507,7 @@ gfc_impure_variable (gfc_symbol *sym)

   proc = sym->ns->proc_name;
   if (sym->attr.dummy
+      && !sym->attr.value
       && ((proc->attr.subroutine && sym->attr.intent == INTENT_IN)
          || proc->attr.function))
     return 1;

regtests fine.  Not sure if this is the best solution, since older
Fortran standards seemed to require INTENT(IN) for dummy x, while
F2018 forbids INTENT(INOUT) and INTENT(OUT), as well as ALLOCATABLE,
POINTER and VOLATILE here.


More information about the Gcc-bugs mailing list