https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119994
kargls at comcast dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargls at comcast dot net
--- Comment #3 from kargls at comcast dot net ---
(In reply to anlauf from comment #2)
> 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.
Note, Neil has asked on the J3 mailing list for clarification as there
seems to be a conflict on the requirements of a restricted expression.
F2023, 10.1.11
...
A restricted expression is an expression in which each operation is
intrinsic or defined by a specification function and each primary is
...
(2) an object designator with a base object that is a dummy argument
that has neither the OPTIONAL nor the INTENT(OUT) attribute,
...
(4) an object designator with a base object that is made accessible
by use or host association,