PR fortran/78718
gcc/fortran/ChangeLog:
* resolve.cc (was_declared): Recognize the RESULT attribute so a
function's result variable is not mistaken for a host-associated
symbol of the same name.
gcc/testsuite/ChangeLog:
* gfortran.dg/func_result_8.f90: New test.
if (a.allocatable || a.dimension || a.dummy || a.external || a.intrinsic
|| a.optional || a.pointer || a.save || a.target || a.volatile_
|| a.value || a.access != ACCESS_UNKNOWN || a.intent != INTENT_UNKNOWN
- || a.asynchronous || a.codimension || a.subroutine)
+ || a.asynchronous || a.codimension || a.subroutine || a.result)
return 1;
return 0;
--- /dev/null
+! { dg-do run }
+!
+! PR fortran/78718
+program p
+ integer :: n, m
+ n = 1
+ if (f() /= 1) stop 1
+contains
+ function f() result(m)
+ call s(n, m)
+ end function
+end program
+
+subroutine s(a, b)
+ integer :: a, b
+ b = a
+end subroutine