- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
datafilename = 'dumpfile.666'
inquire(file=datafilename, exist=exists, opened=opn, number=iunit)
which cause the following error:
forrtl: severe(40): recursive I/O operation, unit -256, file unknown
The lines work in other versions of the program, but does not work. I wonder why it says file unknown, when the whole point is to discover whether the file exists. How can there be a recursive operation if I am just inquiring?
I am using Intel Fortran 8.1. Thank you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you, 1) Reduce this to a simple but complete test case, and 2) try it with a more recent compiler? Normally, you get this error if you try to do an I/O operation on a unit while another operation is in progress on the same unit. For example, if you have a function call in an I/O list where the function does I/O on the same unit. I am hard put to come up with a way you would see this with INQUIRE and would like to see a complete test case.
If you have one, please send it to Intel Premier Support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The inquire statement is a part of this section of code(fixed length but ampersands aren't showing up and the formatting is not coming out right):
datafilename = 'dumpfile.666'inquire(file=datafilename, exist=exists, opened=opn, number=iunit)if (.not. exists) then call getlun(idat) open(idat, file=datafilename, status='new', & access='sequential', form='binary')else if (.not. opn) then call getlun(idat) open(idat, file=datafilename, status='old', access='sequential',& form='binary')else idat = iunitend ifwrite(idat) lat_lim(1),lon_lim(1),lat_lim(2),lon_lim(2),& icell_h,icell_w,n_cellsWhen I change the code to the following:datafilename = 'dumpfile.666'
c inquire(file=datafilename, exist=exists, opened=opn, number=iunit)
c if (.not. exists) thencall getlun(idat)open(idat, file=datafilename, status='replace', & access='sequential', form='binary')
c else if (.not. opn) then
c call getlun(idat)
c open(idat, file=datafilename, status='old', access='sequential',
c & form='binary')
c else
c idat = iunit
c end ifwrite(idat) lat_lim(1),l on_lim(1),lat_lim(2),lon_lim(2),& icell_h,icell_w,n_cells
I get an error at the following code:
if (ptr_tmp_3 .eq. 0) call allocate_tmp_3(ptr_tmp_3, n_cells)do 20 j = 1, n_cells n_el = n_per_cell * (j - 1) + n_group icell_service_p27(j) = btest(icell_service(n_el), n_bit)20
continueThe error happens at the "icell_service_p27(j)" line on the first iteration.
The error is:
forttl: severe(157): Program exception: access violation
The loop happens before the "inquire" statement is called.
The function is only called once. The inquire/write statements
to the file are unrelated to the arrays being accessed.
I am wondering why commenting out code is causing a problem in
code that is run through before the commented code would have been run.
If I leave the code as it was originally, then the array access happens with
no problem, and then the program crashes at the inquire statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The combination of symptoms leads me to guess that you've got stack corruption perhaps from incorrect calling mechanisms for routines you're calling, such as getlun. Again, it's impossible to tell without seeing a complete buildable and runnable test case. Excerpts of code don't tell much of anything. When you have such a complete example, please send it to Intel Premier Support. But in the mean time, check your routine declarations carefully - make sure that if you're calling non-Fortran code that you have declared the routines properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the reason for the problem, sort of. I wasn't properly allocating memory for the array "icell_service_p27"(ptr_tmp_3). For whatever reason, the program was reacting differently depending what code I had commented out, even though the commented out portion had nothing to do with the pointer/array(and the new errorcoming before the code that I commented out). With the inquire statement, the program would load the data into unallocated memory and then crash at the inquire statement. Without the inquire statement, the program crashed trying to load the data into unallocated memory. Interesting.
Thanks for the help. It did get me moving in the right direction.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page