I've had the attached patch in my tree for a long and have had no issues. Regression tested numerous times on trunk. OK to commit?
2015-05-XX Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/64925 * symbol.c(check_conflict): Check for a conflict between a dummy argument and an internal procedure name. 2015-05-XX Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/64925 * gfortran.dg/pr64925.f90: New test. -- Steve
Index: gcc/fortran/symbol.c =================================================================== --- gcc/fortran/symbol.c (revision 223094) +++ gcc/fortran/symbol.c (working copy) @@ -458,6 +458,11 @@ check_conflict (symbol_attribute *attr, } } + if (attr->dummy && ((attr->function || attr->subroutine) && + gfc_current_state () == COMP_CONTAINS)) + gfc_error_now ("internal procedure '%s' at %L conflicts with " + "DUMMY argument", name, where); + conf (dummy, entry); conf (dummy, intrinsic); conf (dummy, threadprivate); Index: gcc/testsuite/gfortran.dg/pr64925.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr64925.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/pr64925.f90 (working copy) @@ -0,0 +1,22 @@ +! { dg-do compile } +! PR fortran/64925 +! Original test case provided by Bill Long <longb at cray dot com> +! +subroutine foo(nnn, aaa, bbb, ccc, ddd) + implicit none + integer :: nnn, aaa, bbb(nnn) + integer :: i + do i=1,nnn + aaa = aaa + bbb(ccc(i)) + end do + call ddd(aaa) +contains + integer function ccc(i) ! { dg-error "conflicts with DUMMY" } + integer :: i + ccc = i + end function ccc + subroutine ddd(j) ! { dg-error "conflicts with DUMMY" } + integer j + j = j + 1 + end subroutine ddd +end subroutine foo