From: keith@rahman.earth.ox.ac.uk (Keith Refson)
Subject: f77 -convert big_endian broken?
Date: 09 Sep 1993 14:27:02 GMT [thread overview]
Message-ID: <KEITH.93Sep9152702@rahman.earth.ox.ac.uk> (raw)
I just discovered to my dismay that the "-convert big_endian" option
to f77 doesn't work as expected. If I am reading the manual page
correctly, it ought to produce binary unformatted files compatible
with the Sun machines.
However it doesn't seem to convert floating point data, only integer.
Here's the test program.
program fin
real a(10)
data a/1,2,3,4,5,6,7,8,9,0/
write(7) a
stop
end
which when compiled without any -convert options writes the data:
Dump: fort.7
Offset: 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00000000: 28 00 00 00 00 00 80 3f 00 00 00 40 00 00 40 40 | (......?...@..@@ |
00000010: 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 | ...@...@...@...@ |
00000020: 00 00 00 41 00 00 10 41 00 00 00 00 28 00 00 00 | ...A...A....(... |
With -convert big_endian I get:
Dump: fort.7
Offset: 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00000000: 00 00 00 28 00 00 80 3f 00 00 00 40 00 00 40 40 | ...(...?...@..@@ |
00000010: 00 00 80 40 00 00 a0 40 00 00 c0 40 00 00 e0 40 | ...@...@...@...@ |
00000020: 00 00 00 41 00 00 10 41 00 00 00 00 00 00 00 28 | ...A...A.......( |
Notice that it has done nothing with the fp data and only byte-swapped
the record length words. However the following program
program fin
real a(10)
integer x(10)
equivalence (x,a)
data a/1,2,3,4,5,6,7,8,9,0/
write(7) x
stop
end
produces this output:
Dump: fort.7
Offset: 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00000000: 00 00 00 28 3f 80 00 00 40 00 00 00 40 40 00 00 | ...(?...@...@@.. |
00000010: 40 80 00 00 40 a0 00 00 40 c0 00 00 40 e0 00 00 | @...@...@...@... |
00000020: 41 00 00 00 41 10 00 00 00 00 00 00 00 00 00 28 | A...A..........( |
which *is* byte-swapped, and in fact reads in correctly on Sun
machines.
I am running OSF/1 v1.2. Is this fixed in 1.3?
Keith Refson
--
------------------------------------------------------------------------------
| Email : keith@earth.ox.ac.uk | Dr Keith Refson |
| UUCP : ...!mcsun!uknet!ed!K.Refson| Department of Earth Sciences |
| PHONE(FAX): +44 865 272026 (272072) | Parks Road, Oxford OX1 3PR, UK |
------------------------------------------------------------------------------
next reply other threads:[~1993-09-09 14:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-09-09 14:27 Keith Refson [this message]
1993-09-10 20:34 ` f77 -convert big_endian broken? Jeff Donsbach
1993-09-12 3:06 ` Fred Velijanian
1993-09-24 13:40 ` Janet Jackson
1993-09-24 18:40 ` Mark Bartelt
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox