This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Error message from gfortran


Hi there,
I get the following error message from compiling the attached program;
both Intel 10 and XLF 10 compile this (or the original it was extracted
from) with no troubles. The problem also happens on a recent (about 2
weeks) snapshot of 4.4.
Compiler bug or user error? 

Thanks
Salvatore 

-------------------- output --------------
[sfilippo@localhost bugtest]$ gfortran -c usemod2.f90
usemod2.f90:39.34:

  use foo_mod, protect => s_foobar
                                 1
Error: Name 'foobar' at (1) is an ambiguous reference to 'foobar' from module 's
_foo_mod'
usemod2.f90:46.34:

  use foo_mod, protect => d_foobar
                                 1
Error: Name 'foobar' at (1) is an ambiguous reference to 'foobar' from module 's
_foo_mod'
usemod2.f90:54.13:

  use foo_mod
            1
Error: Name 'foobar' at (1) is an ambiguous reference to 'foobar' from module 's
_foo_mod'
usemod2.f90:57.16:

  call foobar(z)
               1
Error: There is no specific subroutine for the generic 'foobar' at (1)
[sfilippo@localhost bugtest]$ gfortran -v 
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.3.0/configure --prefix=/usr/local/gcc43 --with-mpfr=/u
sr/local/mpfr --with-gmp=/usr/local/gmp
Thread model: posix
gcc version 4.3.0 (GCC) 


-------------------------------------usemod2.f90---------------------------
module s_type_mod
  type s_foo_type
    real(kind(1.e0)), allocatable :: v(:)
  end type s_foo_type
end module s_type_mod
module s_foo_mod
  use s_type_mod
  interface foobar
    subroutine s_foobar(x)  
      use s_type_mod
      type(s_foo_type), intent (inout) :: x
    end subroutine s_foobar
  end interface
end module s_foo_mod

module d_type_mod
  type d_foo_type
    real(kind(1.d0)), allocatable :: v(:)
  end type d_foo_type
end module d_type_mod

module d_foo_mod
  use d_type_mod
    
  interface foobar
    subroutine d_foobar(x)  
      use d_type_mod
      type(d_foo_type), intent (inout) :: x
    end subroutine d_foobar
  end interface
end module d_foo_mod

module foo_mod
  use s_foo_mod
  use d_foo_mod
end module foo_mod

subroutine s_foobar(x)  
  use foo_mod, protect => s_foobar
  type(s_foo_type), intent (inout) :: x
  
  if (.not.allocated(x%v)) allocate(x%v(10))
end subroutine s_foobar

subroutine d_foobar(x)  
  use foo_mod, protect => d_foobar
  type(d_foo_type), intent (inout) :: x
  
  if (.not.allocated(x%v)) allocate(x%v(10))
end subroutine d_foobar


program test
  use foo_mod
  type(d_foo_type) :: z

  call foobar(z)

end program test



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]