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

forrtl severe (157): Program Exception - Access Violation on CLOSES

apfan
Beginner
780 Views
I am converting a large system from HP Unix fortran to ifort on the PC. I was able to get the system to come up after adding the assume byterecl compiler option that I learned about here (thanks!). The system does direct io OPENS and CLOSES. It can OPEN files successfully, but every time it tries to CLOSE a file, I get the ACCESS Violation that I listed in the title. Here are my compile options;

-nologo \\
-c \\
-Qzero \\
-Qsave \\
-Qvc8 \\
-Od \\
-Z7 \\
-MD \\
-check:all \\
-warn:all \\
-warn:nodeclarations \\
-extend-source \\
-iface:default \\
-iface:nomixed_str_len_arg \\
-convert:big_endian \\
-assume:byterecl \\
-traceback \\
-fpe:0 \\
-fpscomp:logicals \\
-nopdbfile \\
-debug:full \\
-DUPPERCASE \\
-DWIN \\
-DWIN32X_9

I commented out some closes, and the internal debugger gave back results like
A103C RDM NFC= 44 ISTAT= 1633434201

and

A103C DIRECT_IO NFC= 22 ISTAT= 1280070990

where A103C is the close routine.

ISTAT is, I think, copied from IOSTAT.

Any suggestions would be greatly appreciated!

0 Kudos
3 Replies
mecej4
Honored Contributor III
780 Views
This post would fare better in the Fortran Compiler for Windows forum.

It is next to impossible to debug a large software program given no source code, not even a few lines suspected of causing problems, without knowing what OS, compiler version were used, when the traceback printout is not shown, ...

Re: "ISTAT is, I think, copied from IOSTAT" : quoting lines of code would be more useful than stating guesses.
0 Kudos
apfan
Beginner
780 Views
So noted! I thought I was on the Windows forum, my apologies. I will repost there.
0 Kudos
jimdempseyatthecove
Honored Contributor III
780 Views
Are these input files or output files (or unknow as to if in/out/undefined)?
Are these files open on multiple IO units?

Insert some diagnostic code in front of close statement to perform INQUIRE...
[bash]LOGICAL :: I_OPENED, I_PENDING
CHARACTER(1024) :: I_NAME
CHARACTER(128) :: I_SHARE, I_WRITE
... 
INQUIRE (YourUnit, OPENED=I_OPENED, NAME=I_NAME, PENDING=I_PENDING, SHARE=I_SHARE, WRITE=I_WRITE)
IF(I_OPENED) THEN
WRITE(*,*) 'OPENED=',I_OPENED', NAME=',I_NAME
WRITE(*,*) 'PENDING=', I_PENDING, ' SHARE=' I_SHARE' ', WRITE=' I_WRITE)
ELSE
  WRITE(*,*) 'UNIT=',YourUnit, ' not open??'
ENDIF
CLOSE YourUnit
...
[/bash]

Jim Dempsey


0 Kudos
Reply