This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug (or mis-feature) in g77 sequential file format
- To: Alberto Garcia <wdpgaara at lg dot ehu dot es>
- Subject: Re: Bug (or mis-feature) in g77 sequential file format
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Fri, 18 Sep 98 16:49:52 +0200
- Cc: GNU Fortran bugs <egcs-bugs at cygnus dot com>
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <Pine.BSF.3.95.980918121905.10479A-100000@lcpxbi.wm.lc.ehu.es>
> I have come accross a problem with the way g77 treats
> sequential binary files on the alpha. My version is:
> GNU F77 version egcs-2.91.57 19980901 (egcs-1.1 release)
> (alpha-dec-osf4.0) compiled by GNU C version egcs-2.91.57
> 19980901 (egcs-1.1 release). GNU Fortran Front End
> version 0.5.24-19980804
> It turns out that this version of g77 for the alpha uses
> 8 bytes for the record's header and trailer (which hold
> the record length), while the very same g77 version on
> my PC running FreeBSD uses 4 bytes. The standard DEC
> Fortran compiler also uses 4-byte headers and trailers.
> This means that I cannot share binary files.
Excellent summary of the "problem". We realised this ourselves in
February. Basically, the options are:
1. Change the Alpha (and other architectures where `long' means
64 bits) to use `int' (32 bit) sized integers to count the
number of bytes in a record.
This would mean an incompatibility with previous releases of
egcs on those architectures.
2. Change all architectures to use 64 bit record lengths - this
would mean to break backwards compatibility for *those*
architectures.
And then, it wouldn't help. Most workstations use 32 bit integers
for the lengths of records in unformatted sequential files, but the
majority (in number of architectures) is big-endian, whereas the
Intel and Alpha architectures are little-endian - so you couldn't
transfer unformatted files between them anyhow.
The real solution is to switch to a file format that's portable
(i.e. "formatted" files) or write conversion routines.
HTH,
Toon.