public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/16597] New: gfortran: bug in unformatted I/O on scratch files
@ 2004-07-16 21:07 anlauf at hep dot tu-darmstadt dot de
  2004-07-17  0:58 ` [Bug libfortran/16597] " bdavis at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: anlauf at hep dot tu-darmstadt dot de @ 2004-07-16 21:07 UTC (permalink / raw)
  To: gcc-bugs

Hi all,

there's apparently a bug in the runtime when handling unformatted I/O on scratch
files.  It reads back garbage after writing.

Sample program:

      program gfbug4
      implicit none

      integer      strlen
      parameter    (strlen = 4)

      integer      iunit, i, k
      character    string *4

      do 10 i = 1, strlen
         string(i:i) = achar (i)
 10   continue

      iunit = 99
      open (UNIT=iunit,FORM='unformatted',ACCESS='direct',RECL=strlen)
      write (iunit, rec=1) string
      read (iunit, rec=1) i
      close (iunit)
      print *, i

      open (UNIT=iunit,FORM='unformatted',ACCESS='direct',
     $      STATUS='scratch',RECL=strlen)
      write (iunit, rec=1) string
      read (iunit, rec=1) k
      close (iunit)
      print *, k

      if (i .eq. k) then
         print *, 'O.K.'
      else
         print *, '*** Bug! ***'
      endif

      end

Result:

% ./a.out 
    67305985
   538976288
 *** Bug! ***


The first write to fort.99 and reading back works fine - it indicates that
I/O has little-endian form, but the second is just 0x20202020.

-- 
           Summary: gfortran: bug in unformatted I/O on scratch files
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at hep dot tu-darmstadt dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16597


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libfortran/16597] gfortran: bug in unformatted I/O on scratch files
  2004-07-16 21:07 [Bug fortran/16597] New: gfortran: bug in unformatted I/O on scratch files anlauf at hep dot tu-darmstadt dot de
@ 2004-07-17  0:58 ` bdavis at gcc dot gnu dot org
  2004-08-26  2:34 ` bdavis at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: bdavis at gcc dot gnu dot org @ 2004-07-17  0:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bdavis at gcc dot gnu dot org  2004-07-17 00:58 -------
it is a run-time library bug.

--bud davis


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|fortran                     |libfortran
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-17 00:58:38
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16597


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libfortran/16597] gfortran: bug in unformatted I/O on scratch files
  2004-07-16 21:07 [Bug fortran/16597] New: gfortran: bug in unformatted I/O on scratch files anlauf at hep dot tu-darmstadt dot de
  2004-07-17  0:58 ` [Bug libfortran/16597] " bdavis at gcc dot gnu dot org
@ 2004-08-26  2:34 ` bdavis at gcc dot gnu dot org
  2004-08-27  7:59 ` cvs-commit at gcc dot gnu dot org
  2004-08-27  8:39 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bdavis at gcc dot gnu dot org @ 2004-08-26  2:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bdavis at gcc dot gnu dot org  2004-08-26 02:34 -------
proposed patch:
http://gcc.gnu.org/ml/fortran/2004-08/msg00225.html

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16597


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libfortran/16597] gfortran: bug in unformatted I/O on scratch files
  2004-07-16 21:07 [Bug fortran/16597] New: gfortran: bug in unformatted I/O on scratch files anlauf at hep dot tu-darmstadt dot de
  2004-07-17  0:58 ` [Bug libfortran/16597] " bdavis at gcc dot gnu dot org
  2004-08-26  2:34 ` bdavis at gcc dot gnu dot org
@ 2004-08-27  7:59 ` cvs-commit at gcc dot gnu dot org
  2004-08-27  8:39 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-27  7:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-27 07:59 -------
Subject: Bug 16597

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bdavis@gcc.gnu.org	2004-08-27 07:59:30

Modified files:
	gcc/testsuite  : ChangeLog 
	libgfortran    : ChangeLog 
	libgfortran/io : transfer.c io.h rewind.c 
Added files:
	gcc/testsuite/gfortran.dg: pr16597.f90 

Log message:
	2004-08-27  Bud Davis  <bdavis9659@comcast.net>
	
	PR fortran/16597
	* io/io.h: created typedef for unit_mode.
	* io/io.h (gfc_unit): added mode to unit structure.
	* io/transfer.c (data_transfer_init): flush if a write then
	read is done on a unit (direct access files).
	* io/rewind.c (st_rewind): Used unit mode instead of global.
	
	* gfortran.dg/pr16597.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4201&r2=1.4202
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/pr16597.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.67&r2=1.68
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/transfer.c.diff?cvsroot=gcc&r1=1.12&r2=1.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/io.h.diff?cvsroot=gcc&r1=1.8&r2=1.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/rewind.c.diff?cvsroot=gcc&r1=1.3&r2=1.4



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16597


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libfortran/16597] gfortran: bug in unformatted I/O on scratch files
  2004-07-16 21:07 [Bug fortran/16597] New: gfortran: bug in unformatted I/O on scratch files anlauf at hep dot tu-darmstadt dot de
                   ` (2 preceding siblings ...)
  2004-08-27  7:59 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-27  8:39 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-27  8:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-27 08:39 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16597


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-08-27  8:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-16 21:07 [Bug fortran/16597] New: gfortran: bug in unformatted I/O on scratch files anlauf at hep dot tu-darmstadt dot de
2004-07-17  0:58 ` [Bug libfortran/16597] " bdavis at gcc dot gnu dot org
2004-08-26  2:34 ` bdavis at gcc dot gnu dot org
2004-08-27  7:59 ` cvs-commit at gcc dot gnu dot org
2004-08-27  8:39 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).