[comp.lang.fortran] bug in IRIS f77 list-directed i/o

mcqueen@acf3.NYU.EDU (David McQueen) (04/12/91)

We have observed what we think is improper behavior of list-directed i/o in a
Fortran program on our Personal IRIS running IRIX 3.3.1.

Running the following program on our Personal IRIS:
 
      a = 0.0
      b = 0.0
      c = 0.0
      read(5,*,err=99) a,b,c
      write(6,*) a,b,c
      stop
   99 write(6,*)'error reading data'
      stop
      end

with an input file which consists of a single line:
1 2 3
elicits the (good) result:

    1.000000       2.000000       3.000000

but running with an input file consisting of the line:
x y z
elicits the (we think bad) result:

   0.0000000E+00  0.0000000E+00  0.0000000E+00

On a Sun 3/50 running SunOS 4.1 we obtain for the above two cases respectively

    1.00000    2.00000    3.00000

and

error reading data

which we think makes more sense.

Is this behavior of the Personal IRIS in accordance with standard Fortran?

--David McQueen, Courant Institute, New York University

jim@jagubox.gsfc.nasa.gov (Jim Jagielski) (04/16/91)

In article <1600002@acf3.NYU.EDU> mcqueen@acf3.NYU.EDU (David McQueen) writes:
}
}We have observed what we think is improper behavior of list-directed i/o in a
}Fortran program on our Personal IRIS running IRIX 3.3.1.
}
}Running the following program on our Personal IRIS:
} 
}      a = 0.0
}      b = 0.0
}      c = 0.0
}      read(5,*,err=99) a,b,c
}      write(6,*) a,b,c
}      stop
}   99 write(6,*)'error reading data'
}      stop
}      end
}
}with an input file which consists of a single line:
}1 2 3
}elicits the (good) result:
}
}    1.000000       2.000000       3.000000
}
}but running with an input file consisting of the line:
}x y z
}elicits the (we think bad) result:
}
}   0.0000000E+00  0.0000000E+00  0.0000000E+00
}
}On a Sun 3/50 running SunOS 4.1 we obtain for the above two cases respectively
}
}    1.00000    2.00000    3.00000
}
}and
}
}error reading data
}
}which we think makes more sense.
}

Yes, it makes more sense. However, the standard says nothing about "errors"
in list directed input. So whatever the compiler does basically is fine.
--
===========================================================================
#include <std/disclaimer.h>
                                 =:^)
           Jim Jagielski                    NASA/GSFC, Code 711.1
     jim@jagubox.gsfc.nasa.gov               Greenbelt, MD 20771

 "I object to all this sex on the television. I mean, I keep falling off!"

ags@seaman.cc.purdue.edu (Dave Seaman) (04/17/91)

In article <4918@dftsrv.gsfc.nasa.gov> jim@jagubox.gsfc.nasa.gov (Jim Jagielski) writes:

>Yes, it makes more sense. However, the standard says nothing about "errors"
>in list directed input. So whatever the compiler does basically is fine.

When discussing I/O errors, the standard makes no distinction between list
directed I/O and any other kind.  The statement is simply:

--------------------------------------------------------------------------

12.6 _Error_and_End-of-File_Conditions_

	The set of input/output error conditions is processor dependent.

	[Discussion of end-of-file conditions deleted.]

	[Discussion of processor response to error or end-of-file conditions
	deleted.]

--------------------------------------------------------------------------

Therefore, a standard-conforming processor need not recognize any I/O error
conditions at all.  If any such conditions are defined, they must be handled in
a standard way.

--
Dave Seaman
ags@seaman.cc.purdue.edu