- 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
Your INTERFACE block and your SUBROUTINE declarations are different
The INTERFACE is not passing the length (L) argument the array dimensions are fixed at 7, whereas the SUBROUTINE is expecting the dimension (L) to be passed.
The INTERFACE declares the last argument as optional whereas the SUBROUTINE does not.
Also the interface is not specifying INTENT(...) the subroutine is.
Jim Dempsey
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your INTERFACE block and your SUBROUTINE declarations are different
The INTERFACE is not passing the length (L) argument the array dimensions are fixed at 7, whereas the SUBROUTINE is expecting the dimension (L) to be passed.
The INTERFACE declares the last argument as optional whereas the SUBROUTINE does not.
Also the interface is not specifying INTENT(...) the subroutine is.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Holmz,
Can you make SICOJT a module procedure and "use" the module in your caller so you don't have to specify an explicit interface? If not, you have to take the extra responsibility to ensure your interface is fully consistent with the actual procedure implementation which is not the case at present as explained by Jim.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah Jim - I tried it with dimension(7) and dimension (*)., and with the intent in the interface.
About all the combinations that I could think of for about an hour or more.
The subroutine does have OPTIONAL specified for DBG, as does the calling interface. Unfortunately I had to print this out and poke in the section by hand at home... Which never proves to be helpful for me cause.
The "----------^" was aimed at the first argument "call1", but I suspect that was not really a clue and I spent a lot of time changing that around in different ways..
FortranFan> While I could do that, this is part of a bunch of existing code. But wth a hugh number of warning, with some subroutines and calls that differ by 3 extra arguments, and some real*8 going to real*4. All I really want to do is to generally clean it up to compile without warnings, or with a lot less and have it run roght.
The optional arguement for debug was so that I do not have to change every peice of code that calls the subroutine I was wanting to debug. But it seems to be quicker tp do that than to use the "optional". The optional has always seemed to be hit or miss for me.
- 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
Try to move away from using INCLUDE 'some header.inc'
This will introduce issues where/when source files are compiled with different but same named include files. Transition to using modules, as this will assure consistent interfaces (as well as errors when calls do not match). The INCLUDE presents no such guarantee.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
jimdempseyatthecove wrote:
Try to move away from using INCLUDE 'some header.inc'
This will introduce issues where/when source files are compiled with different but same named include files. Transition to using modules, as this will assure consistent interfaces (as well as errors when calls do not match). The INCLUDE presents no such guarantee.
Jim Dempsey
^Exactly^ Jim...
For code that wears my name, I am using modules and USE. So I concur with your recommendation.
But that begs the question of what one should do with existing code that needs modification??
In my enthusiasm, or my thoroughness, I turned "-check all" on (really I generally mostly care -check bounds).
After a few uninitialized variables were sorted out, I then tackled the bounds violations.
Then I turned -warn on... (oh Joy... I thought I was about done 2-1/2 weeks ago, before -warn all).
So I then found real*4 and real*8 getting passed around and some subroutine and calls with 'ms. matched' numbers of arguments, and the usual unused variables being so prodigious that the compiler eventually aborts with "too many warnings". Mostly the same include is in all the subroutines and functions, and that one CANNOT be changed, but it could be inclued in a module. After a few hundred in the actual code are excised, I generally disable the "-check unused".
So I delve in with IMPLICIT NONE, and INTENT(in/out), and added INTERFACE SPECIFICATIONS for the optional arguments. And a bevy of "D" lines to sort out where the index are striding beyond the fence.
So that begs the question of how deep and how far one should work on existing code?
Usually if it runs the same with "O0 -check bounds -d-lines" or "-check all" and the same with -O2 or -O3, then that is my minimum level of acceptability. Then later (after some burn in period) I'll recompile with "02 -no-dlines" for the speed.
I usually do not have issues with "-warn all", so I am at a loss to how to tackle some of the interface issues.
The INTERFACE STATEMENTS are working fine for me except for arguments which are RECORDS (and they may have MAP/UNION in those records as well)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Replacing INCLUDE 'file.inc' with USE MOD_file is generally straightforward. It may require that you relocate the line. I use FPP and conditional compile statements
subroutine foo() #ifdef USE_MODULES USE MOD_file #endif implicit none real :: LocalVars #ifndef USE_MODULES INCLUDE 'file.inc' #endif ...
This way I can easily switch back and forth while shaking out any bugs.
What I find that is the lid of the can of worms is when different source files use the same /named/ common but with different variable declarations.
>>The INTERFACE STATEMENTS are working fine for me except for arguments which are RECORDS (and they may have MAP/UNION in those records as well)
For those, I tend to use a user defined type that holds the RECORD and/or MAP/UNION.
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page