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

Namelist read error in DLL project: forrtl: severe (24): end-of-file during read


We are getting an end-of-file during read error when attempting to read any namelist. We have used different namelists, cut them down to just 1 entry for testing, verified file is in correct directory and can be opened, but the end-of file read issue remains.

forrtl: severe (24): end-of-file during read, unit 5, file C:\Users\whoever\ProjectName\sampleNameList.dat, line 4, position 1
Image              PC        Routine            Line        Source
libifcoremd.dll    17FAEB4A  Unknown               Unknown  Unknown

Stack trace terminated abnormally.
Press any key to continue . . .

We created a small sample project to test namelist reads, and that works in its own project, but when the same code is inserted into the larger project it still returns "end-of-file during read".  So it would seem to be something specific to the larger project, or the fact that the small project works in debug testing, but the larger project is tested by compiling the DLL and inserting it into the main application.

Here is the small sample code that works in its own project:

    program mesh
    character(len=20) :: Model

    namelist /NAMELISTTEST/Model
    read(3, NAMELISTTEST, ERR=100)
    write(*,*) Model
    goto 101
100 write(*,*) 'FILE READ ERROR'
101 continue
    end program mesh

Sample namelist file:

Model='Unit 7'

Another version of the larger project is in a working state on a different computer (Win 7), so maybe someone has knowledge of hiccups with other systems (file permissions, etc)? Currently experiencing this issue on Windows Server 2012 Essentials.


0 Kudos
3 Replies
Black Belt Retired Employee

If you can manage to attach a ZIP of a complete project or VS solution that reproduces the problem, we can probably help. The only thing I can think of is that your failing program possibly has already read one line of the file so that the starting token is not seen.

We inserted a REWIND statement before the READ statement to ensure the file is at the beginning. We also moved the project from Server 2012 to a Win7 computer and got the same results, so we can also eliminate the OS as the problem source. The READ statement had only an ERR specifier, no END specifier. When we add an END specifier, the program no longer crashes, but now it goes to the ERR line. So it still encounters an error while reading the namelist file. Then it crashes at a different read that is not a namelist file, so it seems to be something intrinsic with the READ command. Is there some setting in Visual Studio that could have this effect on the READ command? Thanks again.
Black Belt Retired Employee

No setting. Please try to come up with a test case we can build and run.