This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
USE with renaming---possible bug
- From: Salvatore Filippone <salvatore dot filippone at uniroma2 dot it>
- To: Fortran at gcc dot gnu dot org
- Date: Wed, 04 Jul 2007 15:32:44 +0200
- Subject: USE with renaming---possible bug
- Reply-to: salvatore dot filippone at uniroma2 dot it
Hello,
The attached sample code tries a bit of sleight of hand in USEing
entities with renaming; the code is accepted by both Intel Fortran 9.1
on Linux/ix386 and by XLF 10.1 on AIX, but gfortran gives me the
following errors on both 4.2 and 4.3
[sfilippo@localhost RENAME]$ gfortran -c foosub.f90
foosub.f90:114.40:
Call foo_pwrk(pr,p,f,cd,info,work=aux)
1
Error: There is no specific subroutine for the generic 'bar_pwrk' at (1)
[sfilippo@localhost RENAME]$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2.0/configure --prefix=/usr/local/gcc42
--with-mpfr=/home/travel/GCC/BUILDS/mpfr
--with-gmp-lib=/home/travel/GCC/BUILDS/gmp/lib/
--with-gmp=/home/travel/GCC/BUILDS/gmp
Thread model: posix
gcc version 4.2.0
[sfilippo@localhost RENAME]$ /usr/local/gcc43/bin/gfortran -c
foosub.f90
foosub.f90:114.40:
Call foo_pwrk(pr,p,f,cd,info,work=aux)
1
Error: There is no specific subroutine for the generic 'bar_pwrk' at (1)
[sfilippo@localhost RENAME]$ /usr/local/gcc43/bin/gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.3-20070622/configure --prefix=/usr/local/gcc43
--with-mpfr=/home/travel/GCC/BUILDS/mpfr
--with-gmp-lib=/home/travel/GCC/BUILDS/gmp/lib/
--with-gmp=/home/travel/GCC/BUILDS/gmp
Thread model: posix
gcc version 4.3.0 20070622 (experimental)
On the other hand, if I do change the statement
call foo_pwrk
into
call bar_pwrk
then both Intel and XLF give an error message, while gfortran happily
compiles away which seems quite wrong.
Do we have a bug?
Thanks
Salvatore
module foo_base_mod
type foo_dmt
real(kind(1.d0)), allocatable :: rv(:)
integer, allocatable :: iv1(:), iv2(:)
end type foo_dmt
type foo_zmt
complex(kind(1.d0)), allocatable :: rv(:)
integer, allocatable :: iv1(:), iv2(:)
end type foo_zmt
type foo_cdt
integer, allocatable :: md(:)
integer, allocatable :: hi(:), ei(:)
end type foo_cdt
end module foo_base_mod
module bar_prt
use foo_base_mod, only : foo_dmt, foo_zmt, foo_cdt
type bar_dbprt
type(foo_dmt), allocatable :: av(:)
real(kind(1.d0)), allocatable :: d(:)
type(foo_cdt) :: cd
end type bar_dbprt
type bar_dprt
type(bar_dbprt), allocatable :: bpv(:)
end type bar_dprt
type bar_zbprt
type(foo_zmt), allocatable :: av(:)
complex(kind(1.d0)), allocatable :: d(:)
type(foo_cdt) :: cd
end type bar_zbprt
type bar_zprt
type(bar_zbprt), allocatable :: bpv(:)
end type bar_zprt
end module bar_prt
module bar_pr_mod
use bar_prt
interface bar_pwrk
subroutine bar_dppwrk(pr,x,y,cd,info,trans,work)
use foo_base_mod
use bar_prt
type(foo_cdt),intent(in) :: cd
type(bar_dprt), intent(in) :: pr
real(kind(0.d0)),intent(inout) :: x(:), y(:)
integer, intent(out) :: info
character(len=1), optional :: trans
real(kind(0.d0)),intent(inout), optional, target :: work(:)
end subroutine bar_dppwrk
subroutine bar_zppwrk(pr,x,y,cd,info,trans,work)
use foo_base_mod
use bar_prt
type(foo_cdt),intent(in) :: cd
type(bar_zprt), intent(in) :: pr
complex(kind(0.d0)),intent(inout) :: x(:), y(:)
integer, intent(out) :: info
character(len=1), optional :: trans
complex(kind(0.d0)),intent(inout), optional, target :: work(:)
end subroutine bar_zppwrk
end interface
end module bar_pr_mod
module foo_pr_mod
use bar_prt, &
& foo_dbprt => bar_dbprt,&
& foo_zbprt => bar_zbprt,&
& foo_dprt => bar_dprt,&
& foo_zprt => bar_zprt
use bar_pr_mod, &
& foo_pwrk => bar_pwrk
end module foo_pr_mod
Subroutine foo_sub(a,pr,b,x,eps,cd,info)
use foo_base_mod
use foo_pr_mod
Implicit None
!!$ parameters
Type(foo_dmt), Intent(in) :: a
Type(foo_dprt), Intent(in) :: pr
Type(foo_cdt), Intent(in) :: cd
Real(Kind(1.d0)), Intent(in) :: b(:)
Real(Kind(1.d0)), Intent(inout) :: x(:)
Real(Kind(1.d0)), Intent(in) :: eps
integer, intent(out) :: info
!!$ Local data
Real(Kind(1.d0)), allocatable, target :: aux(:),wwrk(:,:)
Real(Kind(1.d0)), allocatable :: p(:), f(:)
info = 0
Call foo_pwrk(pr,p,f,cd,info,work=aux)
return
End Subroutine foo_sub