- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have the following code:
implicit none
real*8,pointer::test(:)=>null()
call allocatetest(test)
end
subroutine allocatetest(test)
implicit none
real*8,pointer::test(:)
if(associated(test))deallocate(test)
allocate(test(100))
test=0.d0
end subroutine
Could anyone tell me how to modify the code to let it also work in release mode? My working envorinment is: Windows XP+VS.net2005+IVF10
Thanks,
Zhanghong Tang
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to make an explicit interface for allocatetest visible to the main program because the argument is an assumed-shape array and also because it is a pointer (either of these would trigger the requirement.) I'm astonished it works even in debug mode.
The simplest fix is to structure the program like this:
... call allocatetest (test)
contains
subroutine allocatetest (test)
...
end subroutine allocatetest
end
Making allocatetest a contained procedure provides the explicit interface.
For more information, see my article Doctor Fortran Gets Explicit.
The simplest fix is to structure the program like this:
... call allocatetest (test)
contains
subroutine allocatetest (test)
...
end subroutine allocatetest
end
Making allocatetest a contained procedure provides the explicit interface.
For more information, see my article Doctor Fortran Gets Explicit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
Thank you very much for your kindly reply. It can work now.
Zhanghong Tang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh, and compiling with /gen-interface and /warn: interface would have told you about this. These are now on by default in newly created VS projects in 10.0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks again! But I just work in 10.0 version. Maybe I need to update to 10.0.26?
Thanks,
Zhanghong Tang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Works in 10.0.025 for me:
C:Documents and SettingsSteve>ifort /gen-interface /warn:interface t.f90
Intel Visual Fortran Compiler for applications running on IA-32, Version 10.0
Build 20070426 Package ID: W_FC_P_10.0.025
Copyright (C) 1985-2007 Intel Corporation. All rights reserved.
t.f90(5) : Warning: The procedure has a dummy argument that has the ALLOCATABLE,
ASYNCHRONOUS, OPTIONAL, POINTER, TARGET, VALUE or VOLATILE attribute. Required explicit interface is missing from original source. [TEST]
call allocatetest(test)
------------------^
C:Documents and SettingsSteve>ifort /gen-interface /warn:interface t.f90
Intel Visual Fortran Compiler for applications running on IA-32, Version 10.0
Build 20070426 Package ID: W_FC_P_10.0.025
Copyright (C) 1985-2007 Intel Corporation. All rights reserved.
t.f90(5) : Warning: The procedure has a dummy argument that has the ALLOCATABLE,
ASYNCHRONOUS, OPTIONAL, POINTER, TARGET, VALUE or VOLATILE attribute. Required explicit interface is missing from original source. [TEST]
call allocatetest(test)
------------------^

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