Bug 16435 - gfortran X edit descriptor failure: test f77-edit-x-out.f
Summary: gfortran X edit descriptor failure: test f77-edit-x-out.f
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2004-07-08 14:09 UTC by David Billinghurst
Modified: 2005-08-02 10:52 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build: i686-pc-cygwin
Known to work:
Known to fail:
Last reconfirmed: 2005-06-25 18:41:55


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Billinghurst 2004-07-08 14:09:29 UTC
Test g77.dg/f77-edit-x-out.f fails with gfortran.

The test is:

C Test Fortran 77 X descriptor 
C      (ANSI X3.9-1978 Section 13.5.3.2)
C
C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
C
C { dg-do run }
C ( dg-output "^" }
      write(*,'(I1,1X,I1,2X,I1)') 1,2,3    ! { dg-output "1 2  3(\n|\r\n|\r)" }
C Section 13.5.3 explains why there are no trailing blanks
      write(*,'(I1,1X,I1,2X,I1,3X)') 1,2,3 ! { dg-output "1 2  3(\n|\r\n|\r)" }
C { dg-output "\$" }
      end

The error is that the second line of output has three trailing blanks
that should not be there (by my reading of the Fortran 77 standard).
This test passed with g77.
Comment 1 Toon Moene 2004-09-09 18:41:38 UTC
Also fails on powerpc-unknown-linux-gnu, using gcc-3.5-20040908.

However, I still have to convince myself this is indeed in error (Standardwise).
Comment 2 CVS Commits 2005-07-14 06:22:10 UTC
Subject: Bug 16435

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pault@gcc.gnu.org	2005-07-14 06:22:00

Modified files:
	libgfortran/io : transfer.c write.c io.h 
	libgfortran    : ChangeLog 
	gcc/testsuite/gfortran.dg/g77: f77-edit-x-out.f 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: tl_editing.f90 

Log message:
	2005-07-12 Paul Thomas  <pault@gcc.gnu.org>
	
	PR libfortran/16435
	* transfer.c (formatted_transfer): Correct the problems
	with X- and T-editting that caused TLs followed by TRs
	to overwrite data, which caused NIST FM908.FOR to fail
	on many tests.
	(data_transfer_init): Zero X- and T-editting counters at
	the start of formatted IO.
	* write.c (write_x): Write specified number of skips with
	specified number of spaces at the end.
	
	2005-07-12  Paul Thomas  <pault@gcc.gnu.org>
	
	PR libfortran/16435
	* gfortran.dg/tl_editting.f90: New.
	* gfortran.dg/g77/f77-edit-x-out.f: Remove XFAIL.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/transfer.c.diff?cvsroot=gcc&r1=1.47&r2=1.48
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/write.c.diff?cvsroot=gcc&r1=1.41&r2=1.42
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/io.h.diff?cvsroot=gcc&r1=1.21&r2=1.22
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.264&r2=1.265
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/f77-edit-x-out.f.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/tl_editing.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5766&r2=1.5767

Comment 3 CVS Commits 2005-07-14 13:34:59 UTC
Subject: Bug 16435

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	pault@gcc.gnu.org	2005-07-14 13:34:49

Modified files:
	libgfortran/io : io.h write.c read.c list_read.c transfer.c 
	libgfortran    : ChangeLog 
	gcc/testsuite/gfortran.dg/g77: f77-edit-x-out.f 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: tl_editing.f90 complex_read.f90 
	                           past_eor.f90 

Log message:
	2005-07-14 Paul Thomas  <pault@gcc.gnu.org>
	
	PR libfortran/16435
	* transfer.c (formatted_transfer): Correct the problems
	with X- and T-editting that caused TLs followed by TRs
	to overwrite data, which caused NIST FM908.FOR to fail
	on many tests.
	(data_transfer_init): Zero X- and T-editting counters at
	the start of formatted IO.
	* write.c (write_x): Write specified number of skips with
	specified number of spaces at the end.
	
	2005-07-14 Paul Thomas  <pault@gcc.gnu.org>
	
	* io/read.c (read_complex): Prevent X formatting during reads
	from going beyond EOR to fix NIST fm908.FOR failure.
	* io/list_read.c (read_complex): Allow complex data in list-
	directed reads to have eols either side of the comma to
	fix NIST FM906.FOR failure.
	(nml_get_obj_data): Cure warnings about initializer braces.
	(namelist_read):  Cure warnings about potentially uninitialized pointers.
	
	2005-07-14  Paul Thomas  <pault@gcc.gnu.org>
	
	PR libfortran/16435
	* gfortran.dg/tl_editting.f90: New.
	* gfortran.dg/g77/f77-edit-x-out.f: Remove XFAIL.
	
	2005-07-14  Paul Thomas  <pault@gcc.gnu.org>
	
	* gfortran.dg/past_eor.f90: New.
	* gfortran.dg/complex_read.f90: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/io.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.16.10.2&r2=1.16.10.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/write.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.23.2.8&r2=1.23.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/read.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.8.10.4&r2=1.8.10.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/list_read.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.14.2.3&r2=1.14.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/transfer.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.32.2.8&r2=1.32.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.163.2.59&r2=1.163.2.60
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/tl_editing.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.2.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/complex_read.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/past_eor.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/f77-edit-x-out.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1&r2=1.1.48.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.275&r2=1.5084.2.276

Comment 4 Paul Thomas 2005-07-14 15:21:13 UTC
Patch committed to mainline and 4.0
Comment 5 Andrew Pinski 2005-07-15 17:41:04 UTC
I think this patch caused applu and fma3d in SPEC CUP2000 FP to fail.  But since i don't have access to 
SEPC I cannot reduce the problem.
Comment 6 Andrew Pinski 2005-07-15 17:47:11 UTC
The diff for an example for what we get in fma3d:
0004:             _/_/_/_/_/_/  _/_/_/      _/_/_/    _/_/_/_/_/_/             _/_/_/_/_/_/_/   _/_/_/_/_/_/-/
       ^@^@^@        _/_/_/_/_/_/  _/_/_/      _/_/_/    _/_/_/_/_/_/             _/_/_/_/_/_/_/   _/_/_/_/_/_/-
/
       ^


Notice the null characters.
Comment 7 Steven Bosscher 2005-07-19 21:37:46 UTC
Paul T, you seem to have caused a problem here.  Could you look into this? 
 
I can help you with a test case if you need it. 
 
 
Comment 8 Paul Thomas 2005-07-20 04:23:48 UTC
Subject: Re:  gfortran X edit descriptor failure:  test
 f77-edit-x-out.f

Please send me the test cases and preferably, post them on Bugzilla.

Paul T


Comment 9 Paul Thomas 2005-07-20 04:29:56 UTC
> I can help you with a test case if you need it. 
>  

Yup, can't do a durned thing unless you show me where it hurts.  I checked every
aspect of the standard that I could.....
Comment 10 Andrew Pinski 2005-07-20 15:38:28 UTC
(In reply to comment #9)
> > I can help you with a test case if you need it. 
> >  
> 
> Yup, can't do a durned thing unless you show me where it hurts.  I checked every
> aspect of the standard that I could.....
I think PR 22570 is an example of the problem.
Comment 11 Steven Bosscher 2005-07-20 16:49:33 UTC
Subject: Re:  gfortran X edit descriptor failure:  test f77-edit-x-out.f

On Wednesday 20 July 2005 06:21, Paul Thomas wrote:
> Please send me the test cases and preferably, post them on Bugzilla.

This is now http://gcc.gnu.org/PR22570.

Gr.
Steven
Comment 12 Francois-Xavier Coudert 2005-08-02 10:52:17 UTC
Closing this bug, then.
Comment 13 Paul Thomas 2005-08-02 15:44:31 UTC
Subject: Re:  gfortran X edit descriptor failure:  test
 f77-edit-x-out.f

fxcoudert at gcc dot gnu dot org wrote:

>------- Additional Comments From fxcoudert at gcc dot gnu dot org  2005-08-02 10:52 -------
>Closing this bug, then.
>
>
Thanks, Francis-Xavier.  I was holding fire because I wasn't entirely 
confident that I had expunged all the nastiness.  I have found two more 
in the course of writing testcases and a NIST exerciser; however, 16435 
can certainly be cleared.

Paul