J3/00-308
Date: 11-Oct-2000
To: J3
From: Stan Whitlock
Subj: When default KIND isn't good enough
Some of us implement Fortran 95 on 64-bit machines. In my case
on Compaq Alpha hardware, that means:
o there is a 64-bit integer, KIND=8
o default integer is 32-bit, KIND=4
o arrays can have dimensions longer that 2**31
o CHARACTER strings can have lengths longer than 2**31
o addresses are 64-bits so Cray-style POINTERs are 64-bits
It doesn't take a 64-bit machine to run into limitations on Fortran
95's default integer but a 64-bit machine makes them really obvious.
Here are the extensions we made to Compaq Fortran to accomodate
64-bit hardware:
o There is a set of Fortran 95 intrinsics that return default
integer according to the Fortran Standard but have to be able
to return a bigger integer value for large data:
LEN (string
[,KIND=scalar-integer-initialization-expression])
SIZE (array [,dim] [,KIND=s-i-i-e])
SHAPE (source [,KIND=s-i-i-e])
LBOUND (array [,dim] [,KIND=s-i-i-e])
UBOUND (array [,dim] [,KIND=s-i-i-e])
MAXLOC (array, dim [,mask] [,KIND=s-i-i-e])
MAXLOC (array [,mask] [,KIND=s-i-i-e])
MINLOC (array, dim [,mask] [,KIND=s-i-i-e])
MINLOC (array, dim [,mask] [,KIND=s-i-i-e])
INDEX (string, substring [,back] [,KIND=s-i-i-e])
LEN_TRIM (string [,KIND=s-i-i-e])
SCAN (string, set [,back] [,KIND=s-i-i-e])
VERIFY (string, set [,back] [,KIND=s-i-i-e])
o Several keywords on INQUIRE and READ take default integer
according to the Fortran Standard. They are
INQUIRE (RECL= , NEXTREC= )
READ (SIZE= )
These specify integer variables that the I/O library stores
into. These keywords were extended to allow INTEGER(8)
targets.
o Notice that READ (REC= ) takes an integer-expression so its
kind is not an issue and we didn't have to do anything
special. This is also true for subscript and substring
expressions etc.
o We support Cray-style POINTERs as an extension so we defined
the intrinsic INT_PTR_KIND() which can be used in
initialization expressions. Users can store addresses in
integer variables that are declared
INTEGER(KIND=INT_PTR_KIND()) :: PTR
This is just FYI for the committee. Of course we should put
something like this into Fortran 2000 since 64-bit machines are
becoming more prevalent. But it wasn't on the list of "modern"
Fortran features.
/Stan