This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gfc_offset question (32 vs. 64 bits)



----- Original Message ----- From: "Steve Ellcey" <sje@cup.hp.com>
Newsgroups: gmane.comp.gcc.fortran
Cc: <fortran@gcc.gnu.org>
Sent: Tuesday, December 14, 2004 10:03 PM
Subject: Re: gfc_offset question (32 vs. 64 bits)



Steve Ellcey wrote:
> Does libgfortran (or any other GCC library) offer a way to pass > compiler
> option information into a library so it could be used to change the
> libraries behaviour? I guess one could invent a new interface to do
> this, I was wondering if there was any existing precedence.


The library reacts to a set of environment variables (see the code following
line 427 in runtime/environ.c). Maybe we would like this to be setable at runtime.


- Tobi

That certainly looks interesting. What do people think about an environment variable to control this? gfc_offset would get set just like it does now but you could set an environment variable GFORTRAN_RECORD_OFFSET_SIZE to either 32 or 64. If gfc_offset were a 64 bit variable but GFORTRAN_RECORD_OFFSET_SIZE were set to 32 then we would restrict the value to 32 bits and only write out 32 bits to the unformatted sequential file. If GFORTRAN_RECORD_OFFSET_SIZE were set to 64 and sizeof (gfc_offset) is only 32 we would ignore it.


To make the behaviour of the program dependent on an environment variable is the worst
design possible. The intel compiler introduced it circa version 6.x (" F_UFMTENDIAN ")
and it is a constant source of trouble. Typically, after a while, the user sets this variable in its
environment. Then, when working on a new project, a different code starts to produce
"corrupted" files. That's bad.
Better designs are:
- add a compiler option (The intel compiler version 8.x inherited it from the Digital compiler.
Mistake fixed !) so that the resulting executable has a predictable behaviour.
- parse the options passed to the executable and make the behaviour dependent on a magic
option such as "-Wfrte,offset=64".


As usual with open source software, the final design will depend on who does the coding job.

Regards,









Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]