public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42090]  New: Problems when reading partial records in formatted direct access files
@ 2009-11-18  9:04 ian dot bush at nag dot co dot uk
  2009-11-18 10:57 ` [Bug fortran/42090] " burnus at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ian dot bush at nag dot co dot uk @ 2009-11-18  9:04 UTC (permalink / raw)
  To: gcc-bugs

Consider the following:

Wot now ? cat da.f90
Program da

  Implicit None

  Real :: a, b

  a = 1.111111111
  b = 2.222222222

  Open( 10, File = 't.dat', Form = 'Formatted', Access = 'Direct', Recl = 12 )
  Write( 10, rec = 1, fmt = '( f6.4, /, f6.4 )' ) a, b
  Close( 10 )

  a = -1.0
  b = -1.0

  Open( 10, File = 't.dat', Form = 'Formatted', Access = 'Direct', Recl = 12 )

  Read( 10, rec = 1, fmt = '( f6.4, /, f6.4 )' ) a, b
  Write( *, '( "Partial record 1", t25, 2( f6.4, 1x ) )' ) a, b

  Read( 10, rec = 1, fmt = '( f6.4 )' ) a, b
  Write( *, '( "Partial record 2", t25, 2( f6.4, 1x ) )' ) a, b

  Read( 10, rec = 1, fmt = '( f12.4, /, f12.4 )' ) a, b
  Write( *, '( "Full record 1", t25, 2( f6.4, 1x ) )' ) a, b

  Read( 10, rec = 1, fmt = '( f12.4 )' ) a, b
  Write( *, '( "Full record 2", t25, 2( f6.4, 1x ) )' ) a, b

  Read( 10, rec = 1, fmt = '( f6.4, 6x, /, f6.4, 6x )' ) a, b
  Write( *, '( "Full record with 6x", t25, 2( f6.4, 1x ) )' ) a, b

  Read( 10, rec = 1, fmt = '( f6.4 )' ) a
  Read( 10, rec = 2, fmt = '( f6.4 )' ) b
  Write( *, '( "Record at a time", t25, 2( f6.4, 1x ) )' ) a, b

End Program da
Wot now ? ~/Download/usr/local/gfortran/bin/gfortran --version
GNU Fortran (GCC) 4.5.0 20091116 (experimental) [trunk revision 154218]
Copyright (C) 2009 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

Wot now ? ~/Download/usr/local/gfortran/bin/gfortran -W -Wall -pedantic
-fbounds-check -g -O2 da.f90
Wot now ? ./a.out
Partial record 1        1.1111 0.0000
Partial record 2        1.1111 0.0000
Full record 1           1.1111 2.2222
Full record 2           1.1111 2.2222
Full record with 6x     1.1111 2.2222
Record at a time        1.1111 2.2222
Wot now ? 

Note that when reading partial records gfortran gets the value of b wrong.
Compare g95 and the sun fortran compiler:

Wot now ? g95 --version
G95 (GCC 4.0.3 (g95 0.92!) Mar 27 2009)
Copyright (C) 2002-2008 Free Software Foundation, Inc.

G95 comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of G95
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
Wot now ? g95 -W -Wall -pedantic -fbounds-check -g -O2 da.f90
Wot now ? ./a.out
Partial record 1        1.1111 2.2222
Partial record 2        1.1111 2.2222
Full record 1           1.1111 2.2222
Full record 2           1.1111 2.2222
Full record with 6x     1.1111 2.2222
Record at a time        1.1111 2.2222
Wot now ? f90 -V
f90: Sun Fortran 95 8.4 Linux_i386 2009/06/03
Usage: f90 [ options ] files.  Use 'f90 -flags' for details
Wot now ? f90 da.f90
Wot now ? ./a.out
Partial record 1        1.1111 2.2222
Partial record 2        1.1111 2.2222
Full record 1           1.1111 2.2222
Full record 2           1.1111 2.2222
Full record with 6x     1.1111 2.2222
Record at a time        1.1111 2.2222

I've also checked against the intel, portland group, pathscale and cray
compilers and they all give what I think is the correct result, i.e. the same
as g95 and the sun compiler

Also sorry about screwing up the first attempt at submission !


-- 
           Summary: Problems when reading partial records in formatted
                    direct access files
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ian dot bush at nag dot co dot uk


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


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

* [Bug fortran/42090] Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
@ 2009-11-18 10:57 ` burnus at gcc dot gnu dot org
  2009-11-18 11:03 ` [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: " burnus at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-11-18 10:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-11-18 10:57 -------
*** Bug 42089 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
  2009-11-18 10:57 ` [Bug fortran/42090] " burnus at gcc dot gnu dot org
@ 2009-11-18 11:03 ` burnus at gcc dot gnu dot org
  2009-11-18 18:04 ` jvdelisle at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-11-18 11:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-11-18 11:03 -------
It's a regression with regards to 4.1.2. Jerry can you have a look?


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at gcc dot gnu dot
                   |                            |org
           Keywords|                            |wrong-code
      Known to fail|                            |4.3.4 4.4.1 4.5.0
      Known to work|                            |4.1.2
            Summary|Problems when reading       |[4.3/4.4/4.5 Regression]
                   |partial records in formatted|I/O: Problems when reading
                   |direct access files         |partial records in formatted
                   |                            |direct access files
   Target Milestone|---                         |4.3.5


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
  2009-11-18 10:57 ` [Bug fortran/42090] " burnus at gcc dot gnu dot org
  2009-11-18 11:03 ` [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: " burnus at gcc dot gnu dot org
@ 2009-11-18 18:04 ` jvdelisle at gcc dot gnu dot org
  2009-11-19  3:49 ` jvdelisle at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-11-18 18:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2009-11-18 18:04 -------
Yes, I will have a look tonight.


-- 


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
                   ` (2 preceding siblings ...)
  2009-11-18 18:04 ` jvdelisle at gcc dot gnu dot org
@ 2009-11-19  3:49 ` jvdelisle at gcc dot gnu dot org
  2009-11-19  4:50 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-11-19  3:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2009-11-19 03:49 -------
Confirmed and have a patch.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-11-19 03:49:04
               date|                            |


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
                   ` (3 preceding siblings ...)
  2009-11-19  3:49 ` jvdelisle at gcc dot gnu dot org
@ 2009-11-19  4:50 ` jvdelisle at gcc dot gnu dot org
  2009-11-19  5:27 ` jvdelisle at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-11-19  4:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2009-11-19 04:50 -------
Subject: Bug 42090

Author: jvdelisle
Date: Thu Nov 19 04:50:04 2009
New Revision: 154316

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154316
Log:
2009-11-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/42090
        * io/transfer.c (skip_record): Set bytes_left_subrecord to zero after
        skipping the remaining bytes in the record.
        (next_record_r): Call skip_record with the number of bytes_left to be
        skipped.

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


-- 


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
                   ` (4 preceding siblings ...)
  2009-11-19  4:50 ` jvdelisle at gcc dot gnu dot org
@ 2009-11-19  5:27 ` jvdelisle at gcc dot gnu dot org
  2009-11-20  4:00 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-11-19  5:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2009-11-19 05:27 -------
Subject: Bug 42090

Author: jvdelisle
Date: Thu Nov 19 05:27:15 2009
New Revision: 154317

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154317
Log:
2009-11-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/42090
        * gfortran.dg/direct_io_11.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/direct_io_11.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
                   ` (5 preceding siblings ...)
  2009-11-19  5:27 ` jvdelisle at gcc dot gnu dot org
@ 2009-11-20  4:00 ` jvdelisle at gcc dot gnu dot org
  2009-11-20  4:03 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-11-20  4:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jvdelisle at gcc dot gnu dot org  2009-11-20 04:00 -------
Subject: Bug 42090

Author: jvdelisle
Date: Fri Nov 20 04:00:03 2009
New Revision: 154355

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154355
Log:
2009-11-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/42090
        Backport from trunk.
        * io/transfer.c (skip_record): Set bytes_left_subrecord to zero after
        skipping the remaining bytes in the record.
        (next_record_r): Call skip_record with the number of bytes_left to be
        skipped.

Modified:
    branches/gcc-4_4-branch/libgfortran/ChangeLog
    branches/gcc-4_4-branch/libgfortran/io/transfer.c


-- 


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
                   ` (6 preceding siblings ...)
  2009-11-20  4:00 ` jvdelisle at gcc dot gnu dot org
@ 2009-11-20  4:03 ` jvdelisle at gcc dot gnu dot org
  2009-11-21  2:44 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-11-20  4:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2009-11-20 04:02 -------
Subject: Bug 42090

Author: jvdelisle
Date: Fri Nov 20 04:02:33 2009
New Revision: 154356

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154356
Log:
2009-11-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/42090
        * gfortran.dg/direct_io_11.f90: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/direct_io_11.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
                   ` (7 preceding siblings ...)
  2009-11-20  4:03 ` jvdelisle at gcc dot gnu dot org
@ 2009-11-21  2:44 ` jvdelisle at gcc dot gnu dot org
  2009-11-21  2:46 ` jvdelisle at gcc dot gnu dot org
  2009-11-21  3:33 ` jvdelisle at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-11-21  2:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2009-11-21 02:44 -------
Subject: Bug 42090

Author: jvdelisle
Date: Sat Nov 21 02:44:01 2009
New Revision: 154397

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154397
Log:
2009-11-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/42090
        Backport from trunk.
        * io/transfer.c (skip_record): Set bytes_left_subrecord to zero after
        skipping the remaining bytes in the record.
        (next_record_r): Call skip_record with the number of bytes_left to be
        skipped.

Modified:
    branches/gcc-4_3-branch/libgfortran/ChangeLog
    branches/gcc-4_3-branch/libgfortran/io/transfer.c


-- 


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
                   ` (8 preceding siblings ...)
  2009-11-21  2:44 ` jvdelisle at gcc dot gnu dot org
@ 2009-11-21  2:46 ` jvdelisle at gcc dot gnu dot org
  2009-11-21  3:33 ` jvdelisle at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-11-21  2:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jvdelisle at gcc dot gnu dot org  2009-11-21 02:46 -------
Subject: Bug 42090

Author: jvdelisle
Date: Sat Nov 21 02:45:48 2009
New Revision: 154398

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154398
Log:
2009-11-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/42090
        * gfortran.dg/direct_io_11.f90: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/direct_io_11.f90
Modified:
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: Problems when reading partial records in formatted direct access files
  2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
                   ` (9 preceding siblings ...)
  2009-11-21  2:46 ` jvdelisle at gcc dot gnu dot org
@ 2009-11-21  3:33 ` jvdelisle at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-11-21  3:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jvdelisle at gcc dot gnu dot org  2009-11-21 03:33 -------
Fixed and closing.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-11-21  3:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-18  9:04 [Bug fortran/42090] New: Problems when reading partial records in formatted direct access files ian dot bush at nag dot co dot uk
2009-11-18 10:57 ` [Bug fortran/42090] " burnus at gcc dot gnu dot org
2009-11-18 11:03 ` [Bug fortran/42090] [4.3/4.4/4.5 Regression] I/O: " burnus at gcc dot gnu dot org
2009-11-18 18:04 ` jvdelisle at gcc dot gnu dot org
2009-11-19  3:49 ` jvdelisle at gcc dot gnu dot org
2009-11-19  4:50 ` jvdelisle at gcc dot gnu dot org
2009-11-19  5:27 ` jvdelisle at gcc dot gnu dot org
2009-11-20  4:00 ` jvdelisle at gcc dot gnu dot org
2009-11-20  4:03 ` jvdelisle at gcc dot gnu dot org
2009-11-21  2:44 ` jvdelisle at gcc dot gnu dot org
2009-11-21  2:46 ` jvdelisle at gcc dot gnu dot org
2009-11-21  3:33 ` jvdelisle 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).