[patch, libgfortram] PR32456 IO error message should show Unit/Filename

Jerry DeLisle jvdelisle@verizon.net
Sun Jun 24 20:31:00 GMT 2007


:ADDPATCH fortran:

This patch is straightforward.

Internal units have a unit number of zero.  For those, we issue the usual error
message.  For regular files, those with unit number greater than 0, a simple
extension is added to the locus information.

An example:

At line 7 of file error_format.f90 (unit = 99, file = 'foo.dat')
Fortran runtime error: End of file

This has no effect on any existing test cases since it is in the locus output.

The attached test case works, but leaves behind the file.  I have attempted to 
find the right directives for that.  Suggestions welcome.

Regression tested on X86-64.

OK for trunk?

Jerry

2007-06-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32456
	* runtime/error.c (show_locus): Update to emit the unit number
	and file name involved with the error.  Use new function
	filename_from_unit.
	* libgfortran.h (filename_from_unit): Declare new function.
	* io/unit.c (init_units): Set the unit file name for stdin, stdout,
	and stderr for use later in error reporting.
	(filename_from_unit): Add this new function.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr32456.diff
Type: text/x-patch
Size: 3642 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070624/c6eeb695/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error_format.f90
Type: text/x-fortran
Size: 345 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070624/c6eeb695/attachment-0001.bin>


More information about the Fortran mailing list