Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28712 Discussions

Why the unhandled exception when using FORTRAN entry

John6
Novice
660 Views
I have posted a simple program which calls a subroutine (for initialization, and in this case does not do anything) and then an entry in the subroutine. This program produces an unhandled exception which I do not understand. Can anyone explain why I am getting the exception? I am using VStudio 2005, IVF 11.1
The input file is included (job.in).
0 Kudos
4 Replies
Steven_L_Intel1
Employee
660 Views
This program is VERY illegal. When PROGO is called, the only dummy argument allowed to be referenced is JW. This code seems to assume that it is still valid to access W that was passed during the call to PROGI, which is wrong.

I have seen code that does this sort of thing before - in some compilers decades ago, "remembering" of dummy arguments through other entry points worked due to the way ENTRY was implemented, but this has never been legal in Fortran and most current compilers simply won't let this work.
0 Kudos
John6
Novice
660 Views

Sosay we have a subroutine which is called first and initializes some variables, and returns to a calling program. Then later on the calling program returns via an entry statement and uses the data which was originally initialized. You're saying that the original data is not accessible in the entry?

0 Kudos
Steven_L_Intel1
Employee
660 Views
If the variables are local to the subroutine and have the SAVE attribute, then they can be accessed on a subsequent call. If they simply appeared in the subroutine's argument list but are not passed on the call to the entry, then no, they must not be accessed.
0 Kudos
John6
Novice
660 Views
Thanks Steve. I did some more digging and you are correct, this (very old) example code used towork OK when compiled on an old UniSys platform. It was an old technique used in a program I picked up written in the '70s. I have modified it so that the call signatures are correct. I appreciate your comments.
0 Kudos
Reply