https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119994
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2025-04-29
Status|UNCONFIRMED |NEW
--- Comment #2 from anlauf at gcc dot gnu.org ---
Confirmed.
The following patch fixes both cases:
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 07e9bac37a1..46ca7874603 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -3550,7 +3664,7 @@ check_restricted (gfc_expr *e)
break;
}
- if (sym->attr.intent == INTENT_OUT)
+ if (sym->attr.intent == INTENT_OUT && sym->ns == gfc_current_ns)
{
gfc_error ("Dummy argument %qs at %L cannot be INTENT(OUT)",
sym->name, &e->where);
Needs further testing.