[patch, libfortran] PR38439 I/O PD edit descriptor inconsistency

Jerry DeLisle jvdelisle@verizon.net
Sat Oct 10 00:19:00 GMT 2009


Hi All,

The attached patch does several things.

1) Cleans up some comments.

2) Adds runtime error checking for tokens not allowed after a P specifier.

3) Initialize default exponent width where exponent width is optional.

4) Removes some unneeded code.

5) Adjusts the error locus for a few error messages.

The result is as follows.  (There are many variations I will show a few here.)

Compile time:

--- With -std=gnu.

       WRITE (*,'(1PxD24.15,3x,E11.5)') 1.0d0, 1.234
                    1
Error: Comma required after P descriptor in format string at (1)

--- With -std=f95 and comma after P.

pr38439.f:3.20:

       WRITE (*,'(1P,xD24.15,3x,E11.5)') 1.0d0, 1.234
                     1
Error: Extension: X descriptor requires leading space count at (1)

--- No comma after the X. Accepted with -std=gnu.

pr38439.f:4.23:

       WRITE (*,'(1P,1xD24.15,3x,E11.5)') 1.0d0, 1.234
                       1
Error: Extension: Missing comma at (1)

--- No precision specified on E is rejected at compile and run time.

pr38439.f:4.36:

       WRITE (*,'(1P,1x,D24.15,3x,E11)') 1.0d0, 1.234
                                     1
Error: Period required in format specifier E at (1)

On the run time side of things:

At line 5 of file rpr38439.f (unit = 6, file = 'stdout')
Fortran runtime error: Comma required after P descriptor
(1PxD24.15,3x,E11.5)
    ^
The following are accepted.

'(1PD24.15,3x,E11.5)'

'(1PD24.15,3xE11.5)'


Regression tested on x86-64.  OK for trunk.

Regards,

Jerry

2009-10-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/38439
	* io.c (check_format): Fix locus for error messages and fix a comment.

2009-10-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/38439
	* io/format.c (parse_format_list): Add check for tokens not allowed
	after P specifier. Fix comments.  Remove un-needed code. Fix the
	default exponent list. Correct pointer assignment error.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: format.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091010/cfa35e78/attachment.ksh>


More information about the Fortran mailing list