Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Craig Burley <burley@tweedledumb.cygnus.com>
Subject: Re: g77's 8-byte record descriptor
Date: 1998/10/16	[thread overview]
Message-ID: <y6hfx4pgwh.fsf@tweedledumb.cygnus.com> (raw)
In-Reply-To: 705m01$4rq$2@newnews.nl.uu.net

Toon Moene <toon@moene.indiv.nluug.nl> writes:

> What I can clarify is that "decision" is the wrong word to use here - we 
> detected the incompatibility (not being able to read unformatted files 
> produced by a Dec Fortran compiled program in a g77 compiled one (on 
> Alpha/DEC Unix) and vice versa) far too late to do anything on it.

Some background info might be appropriate here.  Most questions about
g77 and I/O facilities are really questions about libf2c, since g77
just uses that.  (But it's nice to see that so many questions about
libf2c on c.l.f are phrased as questions about g77, anyway; there
was a time, even while g77 was available, that that wasn't true.)

libf2c "happened" to pick a type for the record header that became
8 bytes, not 4, on some (or all) OSes on the Alpha, and probably
on other machines as well.

It's true we're loathe to make gratuitous incompatible changes to
g77, from one version to the next, for the same machine/OS combo,
especially in a case where the only problems resulting from the
current situation occur when moving unformatted files between
different systems -- something users should not be depending upon
anyway.

However, while I haven't investigated this fully myself, I believe
there might be some good reasons to use the 8-byte header, or at
least something more than 4 bytes.

In particular, if, as I suspect is the case, the header counts bytes,
not words, and given that the canonical Alpha configuration for
programming uses 4-byte integers (and thus 4-byte array indexes)
but 8-byte pointers (and thus vastly more than a 2GB limit on array
size), it seems to me that there are arrays one could reasonably
declare and use on an Alpha, but not be able to write to a file
if that file's format limited record sizes to byte counts represented
as 4-byte integers.

Whether a particular version of *g77* can take advantage of these
implications for normal, non-I/O code anyway, I don't know offhand,
but the kind of thing I'm thinking of is this:

	PARAMETER (IMAX=2147483647)
	DOUBLE PRECISION A(IMAX)

The array is definitely not too big for an Alpha, although the compiler
has to be careful to multiply out byte offsets in the 8-byte integer
type instead of the 4-byte (so A(IMAX) itself can be addressed without
overflowing a register).

However, I believe the array A could not be properly written to an
unformatted file if g77 defaulted to the 4-byte record headers, as
people are recommending be done.  (I don't know what the failure
mode would be -- perhaps a small amount of the array would be written,
with no diagnostic or other evidence of a problem.)

Even if g77 can't currently handle the above even for non-I/O stuff,
it *should* be able to (I think, speaking offhand), and other compilers
on Alphas might well be able to (and, if so, they should be defaulting
to 8-byte headers as well).  Getting code generation perfectly right
is an ongoing battle, but as Toon suggested with his post, it is
much harder to "fix" file-format problems after releasing products
that ensconse those problems into peoples' files.
-- 

"Practice random senselessness and act kind of beautiful."
James Craig Burley, Software Craftsperson    burley@gnu.org



  parent reply	other threads:[~1998-10-16  4:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-15  4:00 g77's 8-byte record descriptor G. Hugh SONG
1998-10-15  4:00 ` Toon Moene
1998-10-15  4:00   ` Greg Lindahl
1998-10-16  4:00   ` Craig Burley [this message]
1998-10-18  4:00     ` Internal IO bug in g77? (was Re: g77's 8-byte record descriptor) G. Hugh SONG
1998-10-16  4:00   ` g77's 8-byte record descriptor Feng Liu
1998-10-18  4:00     ` Craig Burley
1998-10-18  4:00     ` Toon Moene
1998-10-16  4:00 ` Robert Corbett
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