Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: sysmark@helios.physics.utoronto.ca (Mark Bartelt)
Subject: DEC Fortran V3.3 for OSF/AXP botches "-convert big_endian" output
Date: Tue, 4 May 1993 16:32:45 GMT	[thread overview]
Message-ID: <C6IGMM.H7F@helios.physics.utoronto.ca> (raw)

Consider the following two programs:

	program w
	real*8 x
	data x/123.456/
	open(unit=1,file='x.x',type='new',form='unformatted')
	write (1) x
	close(1)
	end

	program r
	real*8 x
	open(unit=1,file='x.x',type='old',form='unformatted')
	read (1) x
	close(1)
	write (6,666) x
666	format (g20.8)
	end

Running program "w" followed by program "r" produces the correct result
under other versions of UNIX (e.g. SunOS, IRIX).  Things also work as
expected under DEC's OSF/1, unless one uses the "-convert big_endian"
option.

The problem is that "-convert big_endian" does the correct thing on
input, but not on output.  It did work correctly under the field test
version of Fortran (DEC Fortran T3.3(eft1), DFABASE004), but doesn't
work under the official release (DEC Fortran V3.3, DFABASE330).  It's
rather annoying that this bug got introduced so close to release, and
didn't get caught.

Anyway, the details:  When viewed from a big-endian machine, here's what
the contents of the output file look like when program "w" is run on a
big-endian machine:

(A)	00000008 405edd2f 1a9fbe77 00000008

Here's what gets produced by default under DEC OSF/1 (both T3.3(eft1)
and V3.3), again as viewed from a big-endian machine:

(B)	08000000 77be9f1a 2fdd5e40 08000000

This is exactly what you'd expect:  The four-byte record-lengh info is
byte-reversed (relative to a big-endian machine), and the real*8 data
is byte-reversed in the correct way.  Similarly, real*4 variables are
byte-reversed in groups of four, and so on.

But what happens when you compile with "-convert big_endian"?  It ought
to produce the same output as (A) above.  In fact, it generates neither
(A) nor (B), but a clearly incorrect hybrid hodgepodge:

	00000008 77be9f1a 2fdd5e40 00000008

In other words, it produces record-lengh information in a big-endian way,
but the other information is little-endian!

On input, a program compiled with "-convert big_endian" treats both the
record-length information and the data itself as big-endian, as it should.
This means that one can move unformatted data files to AXP OSF/1 from a
big-endian system, but not the reverse.

Any idea how long it will take to DEC to provide a patch for this problem?
This is a major disaster for many of the users in our group.


                 reply	other threads:[~1993-05-04 16:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
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