Created attachment 31565 [details] testcase The attached code fails with current trunk with what appears to be an overzealous check. The code compiles and works fine with 4.8.1. Commenting the BIND(C) routine call or moving the foobar subroutine outside of foo masks the problem. ----------------------------------------------- [sfilippo@jacobi bug36]$ gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/local/gnu/4.9/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --prefix=/usr/local/gnu/4.9 --enable-languages=c,c++,fortran --with-gmp=/home/travel/GNUBUILD/gmp --with-mpfr=/home/travel/GNUBUILD/mpfr --with-mpc=/home/travel/GNUBUILD/mpc --with-cloog=/home/travel/GNUBUILD/cloog : (reconfigured) ../gcc/configure --prefix=/usr/local/gnu/4.9 --with-gmp=/home/travel/GNUBUILD/gmp --with-mpfr=/home/travel/GNUBUILD/mpfr --with-mpc=/home/travel/GNUBUILD/mpc --with-cloog=/home/travel/GNUBUILD/cloog --enable-languages=c,c++,fortran,lto --no-create --no-recursion : (reconfigured) ../gcc/configure --prefix=/usr/local/gnu/4.9 --with-gmp=/home/travel/GNUBUILD/gmp --with-mpfr=/home/travel/GNUBUILD/mpfr --with-mpc=/home/travel/GNUBUILD/mpc --with-cloog=/home/travel/GNUBUILD/cloog --enable-languages=c,c++,fortran,lto --no-create --no-recursion Thread model: posix gcc version 4.9.0 20140102 (experimental) (GCC) [sfilippo@jacobi bug36]$ gfortran -c testcase.f90 testcase.f90:59.22: call a%mv_to(acsc) 1 Error: 'mv_to_base' at (1) is not a function
Confirmed. There is some strange interaction with BIND(C). Reduced test case: module base_mod implicit none type outer contains procedure, nopass :: mv_to_base end type contains subroutine mv_to_base end subroutine subroutine foobar type(outer) :: a integer :: info interface integer function try() bind(c) end function end interface call a%mv_to_base() info = try() end subroutine end module
This PR is fixed by the patch for PR 59023 posted at: http://gcc.gnu.org/ml/fortran/2013-12/msg00139.html
Author: janus Date: Mon Jan 6 11:31:34 2014 New Revision: 206355 URL: http://gcc.gnu.org/viewcvs?rev=206355&root=gcc&view=rev Log: 2014-01-06 Janus Weil <janus@gcc.gnu.org> PR fortran/59023 PR fortran/59662 * resolve.c (resolve_global_procedure): Don't apply to c-binding procedures. (gfc_verify_binding_labels): Remove duplicate line. 2014-01-06 Janus Weil <janus@gcc.gnu.org> PR fortran/59023 * gfortran.dg/bind_c_procs_2.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/bind_c_procs_2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog
Fixed with r206355. Closing.