https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122434
kargls at comcast dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargls at comcast dot net
--- Comment #2 from kargls at comcast dot net ---
(In reply to Paul Thomas from comment #1)
> This one-liner fixes it and regtests OK.
>
> diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
> index 117a51c7e9a..ecd2ada36a3 100644
> --- a/gcc/fortran/resolve.cc
> +++ b/gcc/fortran/resolve.cc
> @@ -18956,7 +18956,8 @@ gfc_impure_variable (gfc_symbol *sym)
> {
> if (ns == sym->ns)
> break;
> - if (ns->proc_name->attr.flavor == FL_PROCEDURE && !sym->attr.function)
> + if (ns->proc_name->attr.flavor == FL_PROCEDURE
> + && !(sym->attr.function || sym->attr.result))
> return 1;
> }
Paul, I read through the code for gfc_impure_variable()
and believe that this is the correct fix. I spent some
time yesterday looking at a patch in match.cc where the
error is generated, but yours is much simpler. Feel
free to commit.