Re: ENTRY statement
- From: Tim Prince <tprince@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 11 Dec 2005 18:30:48 GMT
Swandog46 wrote:
This has no chance of working on many compilers, unless the arguments are copied to variables which are declared with SAVE. It may have been written for a compiler which supported f77, but f77 did not even require an option to check for standards compliance. AIX Fortran no doubt had a peculiar ENTRY extension prior to f77, which they decided to continue to support after f77.Hello everyone; I had a question about how the ENTRY statement passes arguments. I have not been able to find this information in any of the standard resources, most of which simply say "avoid using the ENTRY statement" (which believe me, I would if it were my decision!). I am trying to debug a program originally written for an old IBM AIX f77 compiler. The program crashes using g77 in Linux and I have tracked it down to the use of ENTRY. I have a feeling it is because of the way arguments are passed and do or do not persist across calls. A function is called with some set of arguments, it begins at the top, runs correctly through its entire code and returns. Afterwards, the same function is called from an ENTRY point, enters the function at the entry point below the top, and fails. My question is this: when you call a function from the top and it returns, I assume local variables, including storage for arguments to the function, are all destroyed. But then if you call the function again from an ENTRY statement, are the same variables created? Do any of them persist?
I have a feeling I am not making myself very clear, so let me try to illustrate my question more concretely. Suppose I have the following function:
FUNCTION BLAH(X, Y, Z)
INTEGER*4 N IMPLICIT REAL*8 (A-H, O-Z)
(some code)
ENTRY BLAHBLAH(S)
VAR = X + S
(or whatever)
Then suppose I call the function BLAH originally, it enters, completes, and returns. Afterwards, I call the entry statement BLAHBLAH, which crashes somewhere right around the line VAR = X + S. What happened to the variables X, Y, and Z? Are they created at all? Do they persist? If the function is called via the ENTRY statement, does the IMPLICIT REAL even get evaluated? What happens when X is referenced, if X does not exist and if the IMPLICIT statement has never been evaluated?
I hope I have made myself clear. Thank you all so much for any input!
The usual way to use ENTRY is with all the same arguments repeated for each ENTRY. You will note that the standard supports only a few specific legacy uses of ENTRY with changes in the argument list. As I read my copy of M R & C, it would be OK (actually, required by the standard) for the storage of S to over-write the storage of X, with the result X + S == 2*S.
.
- Follow-Ups:
- Re: ENTRY statement
- From: Richard Maine
- Re: ENTRY statement
- References:
- ENTRY statement
- From: Swandog46
- ENTRY statement
- Prev by Date: Re: ENTRY statement
- Next by Date: Re: ENTRY statement
- Previous by thread: Re: ENTRY statement
- Next by thread: Re: ENTRY statement
- Index(es):
Relevant Pages
|