I've committed the following patch as obvious. 2019-01-15 Steven G. Kargl <ka...@gcc.gnu.org>
PR fortran/81849 * resolve.c (resolve_symbol): Host associated varaibles can appear in the specification statement of a RESULT array. 2019-01-15 Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/81849 * gfortran.dg/pr81849.f90: New test. Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 267945) +++ gcc/fortran/resolve.c (working copy) @@ -15345,7 +15345,7 @@ resolve_symbol (gfc_symbol *sym) /* Set the formal_arg_flag so that check_conflict will not throw an error for host associated variables in the specification expression for an array_valued function. */ - if (sym->attr.function && sym->as) + if ((sym->attr.function || sym->attr.result) && sym->as) formal_arg_flag = true; saved_specification_expr = specification_expr; Index: gcc/testsuite/gfortran.dg/pr81849.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr81849.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr81849.f90 (working copy) @@ -0,0 +1,16 @@ +! { dg-do run } +! PR fortran/81849 +program p + implicit none + integer :: n=3 + if (any(g() /= f())) stop 1 + contains + function g() + real g(n) + g = 7 + end function g + function f() result(r) + real r(n) + r = 7 + end function f +end program -- Steve