From f7c1c1719230dc619e465a5a2e1d2553e98ff090 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Mon, 18 May 2015 19:25:49 +0000 Subject: [PATCH] re PR fortran/64925 (ICE with same names for dummy arg and internal procedure) 2015-05-18 Steven G. Kargl PR fortran/64925 * symbol.c(check_conflict): Check for a conflict between a dummy argument and an internal procedure name. 2015-05-18 Steven G. Kargl PR fortran/64925 * gfortran.dg/pr64925.f90: New test. From-SVN: r223313 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/symbol.c | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr64925.f90 | 22 ++++++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr64925.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index dcdf95e36c3..6913d881b09 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-05-18 Steven G. Kargl + + PR fortran/64925 + * symbol.c(check_conflict): Check for a conflict between a dummy + argument and an internal procedure name. + 2015-05-16 Jerry DeLisle PR fortran/65903 diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index b18608b9ab2..e470cb956a7 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -458,6 +458,11 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) } } + 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c5e67371d11..593427cdbf0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-18 Steven G. Kargl + + PR fortran/64925 + * gfortran.dg/pr64925.f90: New test. + 2015-05-18 Steven G. Kargl * gfortran.dg/lto/pr41521_0.f90: Move INTERFACE statement in program diff --git a/gcc/testsuite/gfortran.dg/pr64925.f90 b/gcc/testsuite/gfortran.dg/pr64925.f90 new file mode 100644 index 00000000000..612a9c9dbcf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr64925.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! PR fortran/64925 +! Original test case provided by Bill Long +! +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 -- 2.30.2