Bug 36131 - [4.4 Regression] wrong IO
Summary: [4.4 Regression] wrong IO
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Jerry DeLisle
URL:
Keywords: wrong-code
: 36142 (view as bug list)
Depends on:
Blocks: 29975
  Show dependency treegraph
 
Reported: 2008-05-05 12:58 UTC by Joost VandeVondele
Modified: 2008-05-07 02:45 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.2 4.1.3 4.3.0
Known to fail: 4.4.0
Last reconfirmed: 2008-05-05 14:49:53


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2008-05-05 12:58:06 UTC
gfortran [trunk revision 134945] generates wrong output for the following testcase (derived from CP2K) :

 write(6,FMT='(T2,A,T10,A)') "23456789012345","ABC"
 END

yields:
 23456789012345ABC

instead of:
 23456789ABC345
Comment 1 Jerry DeLisle 2008-05-05 14:49:53 UTC
I will have a look.  Odd, I don't recall anything going near this recently.
Comment 2 Jerry DeLisle 2008-05-06 01:43:23 UTC
*** Bug 36142 has been marked as a duplicate of this bug. ***
Comment 3 Jerry DeLisle 2008-05-06 02:27:57 UTC
The regression occurs from r132512, the change to transfer.c

The test case from pr36142 is:

! { dg-do  run }
! Adapted from fmt_t_6.f testcase for PR 34782
      character a(6)
      data a / 'a', 'b', 'c', 'd', 'e', 'f' /
      write(*,'(T20,A3,  T1,A4,  T5,A2,  T7,A2,  T9,A4, T17,A2)')
     1 'a', 'b', 'c', 'd', 'e', 'f' 
      print *, 'should be'
      write (*, '(A)') "   b c d   e     f   a"
      end

By reverting the relevant portion of the patch, these two test cases pass which leaves fmt_t_7.f failing which the original patch was intended for.  fmt_t_7.f is an extreme case which is not time critical to fix.

I plan to revert the patch and xfail fmt_t_7.f90 until we sort this out further.
See my comment to pr36142 on the alloc facility.
Comment 4 Jerry DeLisle 2008-05-06 04:01:26 UTC
Subject: Bug 36131

Author: jvdelisle
Date: Tue May  6 04:00:38 2008
New Revision: 134973

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134973
Log:
2008-05-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/36131
	* io/transfer.c (formatted_transfer_scalar): Revert patch for PR34974.
	(next_record_w): Likewise.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/transfer.c

Comment 5 Jerry DeLisle 2008-05-06 04:02:17 UTC
Fixed on trunk, reopened PR34974
Comment 6 Thomas Koenig 2008-05-06 20:53:12 UTC
Hi Jerry,

did you commit the test case to make sure we don't
regress again?

Thomas
Comment 7 Jerry DeLisle 2008-05-07 02:45:43 UTC
One of the problems here is how to do a test case for writing to stdout.  We would have to create a pipe and write to it and read back from the other side.  I don't know how to do that in the testsuite.