Re: Strange Porting Problem CVF to IVF, requesting help and ideas.



Richard E Maine wrote:
...
In particular, LOC returns an integer. I might add that it is an integer
of default size, although early standard Fortran only acknowledged a
single size of integer (and only a single size was available on some
important architectures, speaking of architectural neutrality).

On the compilers that I am familiar with, LOC returns a 64-bit integer
when the code is compiled for a 64-bit memory model. The problem is
that the result gets silently 'narrowed' when fed into a default-sized
integer. As you say:

.... An example from today is so-called 64-bit systems, where
addresses take 64 bits, but default Fortran integers are still 32 bits.

Yup. And a number of the Fortran intrinsic functions are broken because
of this. Things like SIZE, UBOUND, LBOUND, LEN, LEN_TRIM, INDEX, and
so on. Code silently breaks as arrays and character strings, grow past
2gig. It is really a bad problem.

F2003 tried to patch around some of this by allowing a KIND arg on the
intrinsics. But I think this was a poor symptomatic fix at best.

IMO, the Standard should have a KIND available, perhaps residing in
ISO_FORTRAN_ENV, which represents an integer capable of holding the
SIZE of the largest array the implementation supports. (Kinda like
size_t in C.) Same for character string length. Then the intrinsics
should be defined to return results in terms of these types/kinds.

There would be no compatibility issues that I can see. Just programs
that used to be broken would suddenly start working...

Walt
.



Relevant Pages

  • Re: Intrinsics for Statistics
    ... certain basic intrinisics aren't provided in Fortran. ... Factorial, combinations, permutations, etc. ... Should future direction be to provide domain-specific modules rather than intrinsics? ... there are no martix solvers or sort routines in standard Fortran is ...
    (comp.lang.fortran)
  • Re: Intrinsics for Statistics
    ... certain basic intrinisics aren't provided in Fortran. ... yourself, bloat avoidance, too messy (e.g. distribution selection), ... the guiding principles for deciding what intrinsics to add? ... Many statisticians use statistical packages to analyze data rather ...
    (comp.lang.fortran)
  • Re: SGI fortran compilation problem
    ... > PGI Fortran and Intel Fortran have no trouble compiling it. ... the TIME procedure is not standard Fortran. ... recommendation to use the standard intrinsics instead of ...
    (comp.lang.fortran)
  • Re: end-of-record versus end-of-file?
    ... Is Mil-Std-1753 an official part of the Fortran 95 standard? ... IOR, IAND, NOT, and IEOR intrinsics ... When an attempt is made to read a record beyond the end of an internal file. ...
    (comp.lang.fortran)
  • Re: VECTOR data types and intrinsic functions
    ... We are proposing a new feature to GNU Fortran compiler, ... VECTOR data types and to enable some machine specific vector intrinsic ... direct accesss to the intrinsics, ...
    (comp.lang.fortran)