From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1094ba,7ef79818b92a9085 X-Google-Attributes: gid1094ba,public X-Google-Thread: 111c93,7ef79818b92a9085 X-Google-Attributes: gid111c93,public From: Craig Burley Subject: Re: g77's 8-byte record descriptor Date: 1998/10/16 Message-ID: #1/1 X-Deja-AN: 401942991 References: <704fpu$835$1@news.kjist.ac.kr> <705m01$4rq$2@newnews.nl.uu.net> Organization: Cygnus Support Newsgroups: comp.lang.fortran,comp.os.linux.alpha Toon Moene 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