Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29362 Discussions

Error: The type of the actual argument differs from the type of the dummy argument

pierangelo_f_
Beginner
1,072 Views

With the following source code:

subroutine

pippo( n )

implicit none

interface

subroutine pluto( row )

type array

integer(4), dimension(:), pointer :: col

end type array

type(array), dimension(:), pointer :: row

end subroutine pluto

end interface

integer, intent(in) :: n

integer :: i, ierr

type array

integer(4), dimension(:), pointer :: col

end type array

type(array), dimension(:), pointer :: row

allocate( row(n), stat = ierr )

if( ierr.gt.0 ) stop 'Allocation error'

do i=1,n

allocate(row(i)%col(i), stat=ierr)

if( ierr.gt.0 ) stop 'Allocation error'

row(i)%col = 0

enddo

call pluto( row )

end subroutine

pippo

I get the ERROR code in the subject.

I don't understand why.

0 Kudos
4 Replies
Steven_L_Intel1
Employee
1,072 Views

Because the actual and dummy arguments are not of "the same declared type". It does not matter if the names and components of the types are the same.

Check out my blog post on IMPORT for a convenient solution.

0 Kudos
mathelon
Beginner
1,072 Views
Hello,

I work with an old fortran code written in the eightys.
With compaq visual fortran, the following extract of the code just produced a warning :

call etunt_k_elem(iregim(n),npi(n),tabt(ipt(1)),tabt(ipt22),
x neq(n),tabt(ipt(4)),tabt(ipt(5)),tabt(ipt20),tabt(ipt21),
x pk0(1,1,n),itrain(1,n),i,vt,tabt(ipt(25)),pkt1,
x tabt(ipt24),tabt(ipt(26)),param0(1,n),tabt(ipt27),iregimold(n))

subroutine etunt_k_elem(iregim,npi,xint,cint,
x neq,lnod,xl,cl,cel,pk0,itrain,itrac,vtn,xlold,pkt,celi,
x lnod0,param0,celold,iregimold)
c
c--- calcul de la solution aux noeuds mobiles partir des solutions du pas de temps prcdent
c
include 'device.ncl'
include 'trans.ncl'
dimension xint(*),cint(*),lnod(*),xl(*),cl(*),cel(*),
x pk0(2,2),itrain(2),vtn(*),xlold(*),pkt(2,*),celi(*),
x lnod0(*),param0(*),celold(*)
.
..........

The type is implicit (I know it's bad but the whole code is written like this). As a consequence, I think there is a problem with tabt(ipt(4)) wich is a real and lnod which is an integer.

With Intel visual fortran this problem product an error... I don't have the time to modify all the structure of the code. How can I interfer on the project settings to treat this pb as a warning ?

Thanks for your help



0 Kudos
Steven_L_Intel1
Employee
1,072 Views
You do understand that this mismatch can give you incorrect results?

Since you refer to a project, my guess is that the project default of interface checking is enabled. In the project settings, Diagnostics page, turn off "Generate interface blocks" and "Check routine interfaces".
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,072 Views

Felotti,

Below is a reworked example that works.

**** However, when compiling with Check Interfaces an error message is returned
Turning off Check Interfaces produces a runable program. Revise thecode to suit your needs and please submit a report to premier support.

*** Note, the test program does not return the allocations

Jim Dempsey

module

foo

type array

integer(4), pointer :: col(:)

end type array

type arrayPointer

type(array), pointer :: row(:)

end type arrayPointer

end module

foo


program

Test

implicit none

interface

subroutine pippo( n )

integer, intent(in) :: n

end subroutine pippo

end interface

call pippo(10)

end

program Test


subroutine

pluto( ap )

use foo

implicit none

type(arrayPointer) :: ap

integer :: r, c

do r=1,size(ap%row)

do c=1,size(ap%row%col)

&nb sp;write(*,*) r,c, ap%row%col(c)

end do

end do

end subroutine

pluto


subroutine

pippo( n )

use foo

implicit none

integer, intent(in) :: n

interface

subroutine pluto( ap )

use foo

implicit none

type(arrayPointer) :: ap

end subroutine pluto

end interface

integer :: i, ierr, j

type(arrayPointer) :: ap

allocate( ap%row(n), stat = ierr )

if( ierr.gt.0 ) stop 'Allocation error'

do i=1,n

allocate(ap%row(i)%col(i), stat=ierr)

if( ierr.gt.0 ) stop 'Allocation error'

do j=1,i

ap%row(i)%col(j) = i*100+j

end do

enddo

call pluto( ap )

end subroutine

pippo

0 Kudos
Reply