- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,all
I had compuiled for WRF model with intel fce 10.1.but there is a error in compiling process:If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element. .Because the WRF program is too big ,so i wrote a simlified program to test.
module test
integer,pointer::a(:)
contains
subroutine ff(a)
integer a(100)
end subroutine
subroutine f
call ff(a(2))
end subroutine
end module test
ifort test.f :
If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element.
How can i do if i dont wanna to modify the program (because the WRF souce codes are very big)?Can i use some compile option?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no compile option to avoid this error - you will have to correct the code.
My understanding is that current versions of WRF do compile with Intel Visual Fortran, though I am not familiar with the details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply.
There are some places in WRF(module_dm.f,module_domain.f,and so on ) which are using the codes like the example. And the same codes can be compiled sucessfully with intel fortran compiler 9.0 .
I just saw the netpage:http://support.intel.com/support/performancetools/sb/CS-028607.htm. Iplan todownload the correspondent version of WRF and Fortran compiler, wish suceed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How would you *correct* the sample code as given in the thread?
At present, all I get is a message that my code is wrong, and I have no guidance about what is right.
By the way, I interpret
integer, pointer :: a(:)
to be a pointer to an array, not an array of pointers. Why would it not be contiguous?
LAT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To correct this example, I would make A an ALLOCATABLE instead of POINTER and change the declaration of the dummy argument A of FF to be (*) rather than (100).
You are correct that this is a pointer to an array but you could define the pointer as pointing to a non-contiguous slice of an array, for example:
A => B(1:10:2)
Because this is possible, "sequence association" is not available for pointer arrays. Since it is NOT possible with allocatable arrays, sequence association is allowed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
INTERFACE
SUBROUTINE GETBCPRESSURE(I,V)
!DEC$ ATTRIBUTES DLLEXPORT, ALIAS: '_getbcpressure' :: GETBCPRESSURE
!DEC$ ATTRIBUTES VALUE :: I
!DEC$ ATTRIBUTES REFERENCE :: V
INTEGER :: I
REAL :: V(*)
END SUBROUTINE
END INTERFACE
REAL :: PRESSURE
CALL GETBCPRESSURE(BCINV,PRESSURE)
It completely baffled me, but I managed to "fix" it as follows:
REAL, ALLOCATABLE :: PRESSUREA(:)
ALLOCATE(PRESSUREA(2))
PRESSUREA(1)=PRESSURE
CALL GETBCPRESSURE(BCINV,PRESSUREA)
PRESSURE=PRESSUREA(1)
Dunno how a single real could cause this error, but oh well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[fortran] module test integer,pointer::a(:) contains subroutine ff(a) integer a(100) end subroutine subroutine f call ff(a(2:)) end subroutine end module test [/fortran]I have no idea whether the actual subroutine (rather than this extract) will use only the slice that is given to it or will try to use the full array. The latter will cause an error, and the former would require that information on the length of the array slice be made available to the subroutine by the caller in some acceptable way.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page