public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/21621] New: Inconsistency with binary sequential output
@ 2005-05-17 13:49 P dot Schaffnit at access dot rwth-aachen dot de
2005-05-17 17:31 ` [Bug libfortran/21621] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: P dot Schaffnit at access dot rwth-aachen dot de @ 2005-05-17 13:49 UTC (permalink / raw)
To: gcc-bugs
Hi!
I think I've found something strange with binary data written SEQUENTIALly...
I was having trouble reading binary data written by gfortran, so I tried to read
that DIRECTly, and... it doesn't to work! (why?)
Here is a small example in f90, and (for the record the same thing in f77, which
worked with g77).
Can someone help me with that?
Thanks!
Philippe
PS: the f90 sources:
!
PROGRAM Check_Record_Length
!
IMPLICIT NONE
!
INTEGER :: IO_Stat
INTEGER, PARAMETER :: Unit_Number = 13
INTEGER, PARAMETER :: Record_Length = 16
! INTEGER, PARAMETER :: Record_Length = 20
INTEGER :: Record_Length_1
INTEGER :: Record_Length_2
INTEGER :: Integer_Variable
!
REAL :: Real_Variable
DOUBLE PRECISION :: Double_Variable
!
CHARACTER ( LEN = * ), PARAMETER :: Name = "Binary_Data"
!
!
! Write 'sequential'
OPEN ( UNIT = Unit_Number, ACTION = "WRITE", FILE = Name, &
& FORM = "UNFORMATTED", ACCESS = "SEQUENTIAL" )
!
Real_Variable = 666
Integer_Variable = 13
WRITE ( UNIT = Unit_Number, IOSTAT = IO_Stat ) &
& Real_Variable, Integer_Variable
!
CLOSE ( UNIT = Unit_Number )
!
!
! Read 'sequential'
OPEN ( UNIT = Unit_Number, ACTION = "READ", FILE = Name, &
& FORM = "UNFORMATTED", ACCESS = "SEQUENTIAL" )
!
READ ( UNIT = Unit_Number, IOSTAT = IO_Stat ) &
& Real_Variable, Integer_Variable
!
WRITE ( 6, "(/G13.5,I13,2I13/)" ) Real_Variable, Integer_Variable
!
CLOSE ( UNIT = Unit_Number )
!
!
! Read 'direct'
OPEN ( UNIT = Unit_Number, ACTION = "READ", FILE = Name, &
& FORM = "UNFORMATTED", ACCESS = "DIRECT", RECL = Record_Length )
!
READ ( UNIT = Unit_Number, REC = 1 ) &
& Record_Length_1, Real_Variable, Integer_Variable, Record_Length_2
! & Record_Length_1, Double_Variable, Integer_Variable, Record_Length_2
! Real_Variable = Double_Variable
!
WRITE ( 6, "(/G13.5,I13,2I13/)" ) Real_Variable, &
& Integer_Variable, Record_Length_1, Record_Length_2
!
CLOSE ( UNIT = Unit_Number )
!
!
END PROGRAM Check_Record_Length
!
PPS: the f77 ones:
!
PROGRAM Check_Record_Length
!
IMPLICIT NONE
!
INTEGER IO_Stat
INTEGER Unit_Number
PARAMETER ( Unit_Number = 13 )
INTEGER Rec_Length
PARAMETER ( Rec_Length = 16 )
INTEGER Record_Length, Record_Length_1, Record_Length_2
INTEGER Integer_Variable
!
REAL Real_Variable
DOUBLE PRECISION Double_Variable
!
CHARACTER ( 11 ) Name
PARAMETER ( Name = "Binary_Data" )
!
!
! Write 'sequential'
OPEN ( UNIT = Unit_Number, FILE = Name,
& FORM = "UNFORMATTED", ACCESS = "SEQUENTIAL" )
!
Real_Variable = 666
Integer_Variable = 13
WRITE ( UNIT = Unit_Number, IOSTAT = IO_Stat )
& Real_Variable, Integer_Variable
!
CLOSE ( UNIT = Unit_Number )
!
!
! Read 'sequential'
OPEN ( UNIT = Unit_Number, FILE = Name,
& FORM = "UNFORMATTED", ACCESS = "SEQUENTIAL" )
!
READ ( UNIT = Unit_Number, IOSTAT = IO_Stat )
& Real_Variable, Integer_Variable
!
WRITE ( 6, "(/G13.5,I13,2I13/)" ) Real_Variable, Integer_Variable
!
CLOSE ( UNIT = Unit_Number )
!
!
! Read 'direct'
OPEN ( UNIT = Unit_Number, FILE = Name,
& FORM = "UNFORMATTED", ACCESS = "DIRECT", RECL = Rec_Length )
!
READ ( UNIT = Unit_Number, REC = 1 )
& Record_Length_1, Real_Variable, Integer_Variable, Record_Length_2
!
WRITE ( 6, "(/G13.5,I13,2I13/)" ) Real_Variable,
& Integer_Variable, Record_Length_1, Record_Length_2
!
CLOSE ( UNIT = Unit_Number )
!
!
END PROGRAM Check_Record_Length
!
--
Summary: Inconsistency with binary sequential output
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: P dot Schaffnit at access dot rwth-aachen dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: GCC 4.1.0 20050517
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21621
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/21621] Inconsistency with binary sequential output
2005-05-17 13:49 [Bug libfortran/21621] New: Inconsistency with binary sequential output P dot Schaffnit at access dot rwth-aachen dot de
@ 2005-05-17 17:31 ` pinskia at gcc dot gnu dot org
2005-05-19 16:44 ` tobi at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-17 17:31 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|GCC 4.1.0 20050517 |
GCC host triplet|i686-pc-linux-gnu |
GCC target triplet| |i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21621
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/21621] Inconsistency with binary sequential output
2005-05-17 13:49 [Bug libfortran/21621] New: Inconsistency with binary sequential output P dot Schaffnit at access dot rwth-aachen dot de
2005-05-17 17:31 ` [Bug libfortran/21621] " pinskia at gcc dot gnu dot org
@ 2005-05-19 16:44 ` tobi at gcc dot gnu dot org
2005-05-19 16:45 ` tobi at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-05-19 16:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tobi at gcc dot gnu dot org 2005-05-19 16:43 -------
Can you be a little more specific on what you're trying to do and why you think
that what gfortran does is wrong?
I don't think the standard requires sequential access files to be in any
reliable format. I find the results surprising, but I'm not yet sure it's a bug.
[tobi@marktplatz tests]$ gfortran pr21621.f
[tobi@marktplatz tests]$ ./a.out
666.00 13
0.0000 1143373824 8 13
[tobi@marktplatz tests]$ g77 pr21621.f
[tobi@marktplatz tests]$ ./a.out
666.00 13
666.00 13 8 8
[tobi@marktplatz tests]$
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |tobi at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-05-19 16:43:58
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21621
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/21621] Inconsistency with binary sequential output
2005-05-17 13:49 [Bug libfortran/21621] New: Inconsistency with binary sequential output P dot Schaffnit at access dot rwth-aachen dot de
2005-05-17 17:31 ` [Bug libfortran/21621] " pinskia at gcc dot gnu dot org
2005-05-19 16:44 ` tobi at gcc dot gnu dot org
@ 2005-05-19 16:45 ` tobi at gcc dot gnu dot org
2005-05-23 9:06 ` P dot Schaffnit at access dot rwth-aachen dot de
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-05-19 16:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tobi at gcc dot gnu dot org 2005-05-19 16:44 -------
Um, I meant to set this to waiting ...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21621
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/21621] Inconsistency with binary sequential output
2005-05-17 13:49 [Bug libfortran/21621] New: Inconsistency with binary sequential output P dot Schaffnit at access dot rwth-aachen dot de
` (2 preceding siblings ...)
2005-05-19 16:45 ` tobi at gcc dot gnu dot org
@ 2005-05-23 9:06 ` P dot Schaffnit at access dot rwth-aachen dot de
2005-05-24 20:33 ` jblomqvi at cc dot hut dot fi
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: P dot Schaffnit at access dot rwth-aachen dot de @ 2005-05-23 9:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From P dot Schaffnit at access dot rwth-aachen dot de 2005-05-23 09:05 -------
Hi!
I was trying to read some binary data written by a GFortran binary with binaries
written with other compilers (LF, SGI), and I couldn't get anywhere, so I just
started to poke around to see where it came from...
I tried to have a look at the Fortran standard, but I didn't get anywhere, but
my experience with several compilers is that they do use this REC-LENGTH thing,
so (and g77 did also!), so I would say it would be a pity to have trouble
reading old binary data from g77 with gfortran...
It's actually a rather self-centered comment, but maybe I'm not the only one...
Cheers!
Philippe
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21621
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/21621] Inconsistency with binary sequential output
2005-05-17 13:49 [Bug libfortran/21621] New: Inconsistency with binary sequential output P dot Schaffnit at access dot rwth-aachen dot de
` (3 preceding siblings ...)
2005-05-23 9:06 ` P dot Schaffnit at access dot rwth-aachen dot de
@ 2005-05-24 20:33 ` jblomqvi at cc dot hut dot fi
2005-05-31 2:37 ` bdavis9659 at comcast dot net
2005-05-31 2:45 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: jblomqvi at cc dot hut dot fi @ 2005-05-24 20:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jblomqvi at cc dot hut dot fi 2005-05-24 20:02 -------
Well no, the standard does not specify how unformatted sequential record markers
are implemented. In short, gfortran uses markers of type off_t, which is 64 bits
on operating systems with large file (LFS) support. Today, that is most OS:es in
common use. g77 AFAIK uses markers of type long, that is 32-bits on most 32-bit
platforms and 64 bits on 64-bit platforms. See also PR 19303. Also note that Bud
Davis is apparently currently working on pluggable record markers, which should
allow gfortran to add some kind of g77 compatibility flag.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21621
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/21621] Inconsistency with binary sequential output
2005-05-17 13:49 [Bug libfortran/21621] New: Inconsistency with binary sequential output P dot Schaffnit at access dot rwth-aachen dot de
` (4 preceding siblings ...)
2005-05-24 20:33 ` jblomqvi at cc dot hut dot fi
@ 2005-05-31 2:37 ` bdavis9659 at comcast dot net
2005-05-31 2:45 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: bdavis9659 at comcast dot net @ 2005-05-31 2:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bdavis9659 at comcast dot net 2005-05-31 02:36 -------
proposed patch here:
http://gcc.gnu.org/ml/fortran/2005-05/msg00431.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21621
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/21621] Inconsistency with binary sequential output
2005-05-17 13:49 [Bug libfortran/21621] New: Inconsistency with binary sequential output P dot Schaffnit at access dot rwth-aachen dot de
` (5 preceding siblings ...)
2005-05-31 2:37 ` bdavis9659 at comcast dot net
@ 2005-05-31 2:45 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-31 2:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-31 02:45 -------
*** This bug has been marked as a duplicate of 19303 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21621
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-05-31 2:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-17 13:49 [Bug libfortran/21621] New: Inconsistency with binary sequential output P dot Schaffnit at access dot rwth-aachen dot de
2005-05-17 17:31 ` [Bug libfortran/21621] " pinskia at gcc dot gnu dot org
2005-05-19 16:44 ` tobi at gcc dot gnu dot org
2005-05-19 16:45 ` tobi at gcc dot gnu dot org
2005-05-23 9:06 ` P dot Schaffnit at access dot rwth-aachen dot de
2005-05-24 20:33 ` jblomqvi at cc dot hut dot fi
2005-05-31 2:37 ` bdavis9659 at comcast dot net
2005-05-31 2:45 ` 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).