routine call with allocatable argument

Jean-Baptiste FAURE jean-baptiste.faure@cemagref.fr
Mon Sep 28 12:13:00 GMT 2009


Hi,

I have a routine A like this :
subroutine A(tab)
real(kind=long),dimension(:),allocatable,intent(inout):: tab
etc.

There is a second routine B which call A :

subroutine B(tab)
real(kind=long),dimension(:,:),allocatable,INTENT(INOUT)::tab
integer :: nx, ny, i
...
    if (allocated(tab)) deallocate(tab)
    allocate(tab(nx,ny))

    do i=1,nx
        call A(tab(i,:))
    end do
...

gfortran conplains with the following error message :
Error: Actual argument for 'tab' must be ALLOCATABLE at (1)
with line number of call A statement

G95 compiles this code without error message and, as far as I can know, 
the produced executable does its job correctly.
Which compiler is Fortran conforming ?

Regards
JBF

-- 
Jean-Baptiste FAURE
Cemagref - Unité de Recherche Hydrologie-Hydraulique
Tel: 04 72 20 87 76 - Fax: 04 78 47 78 75 - Web: www.lyon.cemagref.fr
Cemagref-Lyon 3bis, quai Chauveau C.P.220 69336 Lyon cedex09 FRANCE
Seuls des formats ouverts peuvent assurer la pérennité de vos documents



More information about the Fortran mailing list