http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60596
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Thu, Mar 20, 2014 at 02:27:15AM +0000, patnel97269-gfortran at yahoo dot fr wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60596 > > --- Comment #2 from patnel97269-gfortran at yahoo dot fr --- > Using your program, I get the same behavior I describe . > > Running with gfortran I get ./a.out < tmp.dat > 400 > 0 > 0 > > Running with ifort I get ./a.out < tmp.dat > 400 > 0 > 400 > > Why the size the shell input is 0 ? > Because this line of code: close(input_unit) has closed the input_unit. This closes the stdin stream. input_unit is simply a integer and is commonly the value of 5. The next line now opens unit=input_unit and because you have not specified a file= tag in the open statement open(unit=input_unit, access='stream') you now have a file named 'fort.5'. You have not written anything into fort.5 so it of course has a file size of 0. inquire(unit=input_unit,size=sz) This line of code retrieves the file size from the OS. print *, sz and this one displays. close(input_unit) I have no idea why ifort is reporting 400 for the last bit of code. It looks like a bug in ifort to me.