- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I wrote a program which computes properties of water and steam years ago using f2c under linux. Then I ported this program to Powerstation 1 and later to Powerstation 4. Each time everything worked fine.
Now I want to port to Compaq Visual 6.6 B and I get big problems. After calling a subroutine and a function within this subroutine a dummy parameter of the subroutine is changed without having accessed it.
I downloaded evaluation copy of Intel Fortran 7.1 compiled the program and everything is oK, no strange changing of dummy parameters occurs.
So I'm afraid there is some chaos and I wonder whether it is in CVF stack magament or in my head ;-).
Find attached the sources of this program. If you would find the time and have a look on it. Goto to the file ifc.for and look for the double precision function H2OProp. Inside this function there is a comment beginning with !=> HELP. Place breakpoints as described in the further comment lines.
After having started the prog you will be asked for a parameter p, just type e.g. 13. You will be then asked for a parameter t, just type s without any '. Prog stops at the above mentioned breakpoint. Watch dP. After calling the function sdtemp1, dP is changed, which is totally nonsense.
If you change the Argument Passing Conventions from Default to C, by reference the behauvour is correct. CVF 6.6B acts then like f2c, FPS1, FPS4 and Intel Fortran.
I lost about 12 hours and I didn't get a solution of my problem.
I would be very grateful for any help, hints, comments.
Muppets
I wrote a program which computes properties of water and steam years ago using f2c under linux. Then I ported this program to Powerstation 1 and later to Powerstation 4. Each time everything worked fine.
Now I want to port to Compaq Visual 6.6 B and I get big problems. After calling a subroutine and a function within this subroutine a dummy parameter of the subroutine is changed without having accessed it.
I downloaded evaluation copy of Intel Fortran 7.1 compiled the program and everything is oK, no strange changing of dummy parameters occurs.
So I'm afraid there is some chaos and I wonder whether it is in CVF stack magament or in my head ;-).
Find attached the sources of this program. If you would find the time and have a look on it. Goto to the file ifc.for and look for the double precision function H2OProp. Inside this function there is a comment beginning with !=> HELP. Place breakpoints as described in the further comment lines.
After having started the prog you will be asked for a parameter p, just type e.g. 13. You will be then asked for a parameter t, just type s without any '. Prog stops at the above mentioned breakpoint. Watch dP. After calling the function sdtemp1, dP is changed, which is totally nonsense.
If you change the Argument Passing Conventions from Default to C, by reference the behauvour is correct. CVF 6.6B acts then like f2c, FPS1, FPS4 and Intel Fortran.
I lost about 12 hours and I didn't get a solution of my problem.
I would be very grateful for any help, hints, comments.
Muppets
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I meant that you "reply" to yourself with zip file rather than create a new thread, but never mind.
You have in the calling chain:
I think you owe me a drink :-).
Jugoslav
You have in the calling chain:
double precision function thetak(beta,iErr) ... call mnewt1(ntrial,h,n,tolx,tolf,utk,iErr) ... end !------- SUBROUTINE MNEWT1(NTRIAL,X,N,TOLX,TOLF,usrfun,iErr) external usrfun CALL USRFUN(X,ALPHA,BETA,iErr)but prototype of utk was wrong:
subroutine utk(h,a,b,ierr) --------^ iErr was missingThe "odd" error has gone when I added it to utk. Since in STDCALL (CVF Default) callee cleans the stack, it removed 12 bytes rather than 16 which were actually pushed by Mnewt1, "smashing the stack"; with C, by reference that wouldn't happen because caller cleans the stack. I didn't check for possible other similar situations.
I think you owe me a drink :-).
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's the truth: it should be a maxi jumbo drink!
Thank you very much! I'm afraid I would have searched another two years without having success. You see: chaos was in my head.
Thank you agaim
M;uppets
Thank you very much! I'm afraid I would have searched another two years without having success. You see: chaos was in my head.
Thank you agaim
M;uppets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jugoslav, have one on me for the jargon link, :-).
Ciao,
Gerry T.
Ciao,
Gerry T.

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