This is a follow up to PR30746. While I believe the test case in PR30746 is correct, I think the gfortran.dg/host_assoc_function_1.f90 test case is wrong.
(Simplified, see testsuite for the full file) MODULE m REAL :: x(3) = (/ 1.5, 2.5, 3.5 /) CONTAINS SUBROUTINE s if (x(2) .ne. 2.5) call abort () CONTAINS FUNCTION x(n, m) x = REAL(n)**m END FUNCTION END SUBROUTINE s END MODULE m I am very much in favour of the other compilers which think the "x" in "s" refers to only the contained function "x" and not to the variable. gfortran somehow seems to treat the symbol "x" as generic symbol which means with one argument the variable and with two the function. I would argue that the function name makes the variable inaccessible. Using NAG's f95: Error: host_assoc_function_1.f90, line 22: Too few arguments in reference to X Error: host_assoc_function_1.f90, line 23: Too few arguments in reference to Z ifort: fortcom: Error: host_assoc_function_1.f90, line 22: A non-optional actual argument must be present when invoking a procedure with an explicit interface. [M] [...] -- Summary: Parent and contained procedure: Wrongly treated as generic procedures Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33233