run time error 157 in CVF

run time error 157 in CVF

I am a first time user of CVF but have been writing fortran codes on UNIX and Linux envronments for more than a decade. I moved a program that runs smoothly on HP unix to CVF on win2000 platform and got rid of all compilation errors. I built the executable (TEST.exe) with check:all option (this include checking bounds). I have not been able to execute the program successfully so far.

I keep getting the run time error 157:

forrtl: severe(157): Program Exception - access violation
Image PC Routine Line Source
TEST.exe 0040DB0B CVALLEY_RATES 682 elescat.f
TEST.exe 0040B5CE SCAGAAS 402 elescat.f
TEST.exe 00440BB8 ELMAIN_PARAB 544 mcalnir.f
TEST.exe 004AA2F9 Unknown Unknown Unknown
TEST.exe 0049C6E4 Unknown Unknown Unknown
KERNEL32.dll 77E8D326 Unknown Unknown Unknown

Immediately after line 682 in subroutine cvalley, there is a call to a subroutine. Line 682 is a simple assignment statement (Iva=1). It does not make to thr subroutine.

I used the help menu and got the following about error 157:

"severe(157): Program Exception - access violation
FOR$IOS_ACCVIO. The program tried to read from or write to a virtual address for which it does not have the appropriate access. Try recompiling with the /check:bounds option set to see if the cause is an out-of-bounds memory reference.
This is an operating system error. See your operating system documentation for more information."

The above message did NOT help. I am using option /check:all already.

When I stop the debugger, I get the following message

Loaded symbols for 'D:code01TESTDebugTEST.exe'
Loaded 'C:WINNTsystem32NTDLL.DLL', no matching symbolic information found.
Loaded 'C:WINNTsystem32KERNEL32.DLL', no matching symbolic information found.
Loaded 'C:WINNTsystem32msvcrt.dll', no matching symbolic information found.
Loaded 'C:WINNTsystem32dbghelp.dll', no matching symbolic information found.
The thread 0x654 has exited with code 0 (0x0).
The program 'D:code01TESTDebugTEST.exe' has exited with code 0 (0x0).

So, I went hunting for the above files and found
all the above *.DLL files are in the 'C:WINNTsystem32' directory.

Can any one help me with the above. I hate to switch back to my slow but reliable unix HP workstations.
Thanks.

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Please see this article on access violation The most likely problem is that you have passed a constant as an argument to a routine which tries to modify it. This is not legal in Fortran, but the error is not detected on many platforms.

Steve

Steve - Intel Developer Support

After reading the article, I turned to the variable iva (see below) because as the article says the compiler will reserve a read only location for it. By using a different dummy variable, and compiling the program ran successfully. Thanks for that.

However, this raises an other question: How can I pass back the modified information through an argument? Is there a way during compiling to avoid using read only allocation during execution? I know using a common block will pass the modified information automatically.

program main
..
Call sub1(iva,....)
end

sub1(iva,...)
..
iva=1 !(change to ivc=1)
call sub2(iva,....) !(change iva to ivc)
return
end

Thanks

Variables are not allocated as read-only, but constants are. What I think you did is something like this:

call sub(3)
...
subroutine sub(i)
i = 1

This tries to change the value of the constant 3! It may be that instead of a literal 3 you have a "named constant" (PARAMETER) which can look like a variable if you don't see the declaration.

If you really did pass a variable, there would be no problem changing its value in the subroutine. Can you come up with a short but complete example that shows the original problem?

Steve

Steve - Intel Developer Support

You are right. I checked the call statement and I used a number in the argument.

Call sub1(1,..)

sub1(iva,..)
iva=1

Thanks

Leave a Comment

Please sign in to add a comment. Not a member? Join today