- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With the following source code:
subroutine
pippo( n )implicit noneinterfacesubroutine pluto( row )type arrayinteger(4), dimension(:), pointer :: colend type arraytype(array), dimension(:), pointer :: rowend subroutine plutoend interface integer, intent(in) :: ninteger :: i, ierrtype arrayinteger(4), dimension(:), pointer :: colend type arraytype(array), dimension(:), pointer :: rowallocate( row(n), stat = ierr )if( ierr.gt.0 ) stop 'Allocation error'do i=1,nallocate(row(i)%col(i), stat=ierr)if( ierr.gt.0 ) stop 'Allocation error'row(i)%col = 0
enddocall pluto( row )end subroutine
pippo
I get the ERROR code in the subject.
I don't understand why.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
footype arrayinteger(4), pointer :: col(:)end type arraytype arrayPointertype(array), pointer :: row(:)end type arrayPointerend module
fooTestimplicit noneinterfacesubroutine pippo( n )integer, intent(in) :: nend subroutine pippoend interfacecall pippo(10)
programend
program Testpluto( ap )use fooimplicit nonetype(arrayPointer) :: apinteger :: r, cdo r=1,size(ap%row)do c=1,size(ap%row%col)&nb sp;write(*,*) r,c, ap%row%col(c)end doend do
subroutineend subroutine
plutopippo( n )use fooimplicit noneinteger, intent(in) :: ninterfacesubroutine pluto( ap )use fooimplicit nonetype(arrayPointer) :: apend subroutine plutoend interfaceinteger :: i, ierr, jtype(arrayPointer) :: apallocate( ap%row(n), stat = ierr )if( ierr.gt.0 ) stop 'Allocation error'do i=1,nallocate(ap%row(i)%col(i), stat=ierr)if( ierr.gt.0 ) stop 'Allocation error'do j=1,i
subroutineap%row(i)%col(j) = i*100+j
end doenddocall pluto( ap )end subroutine
pippo
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page