Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: lionel@quark.enet.dec.com (Steve Lionel)
Subject: Re: 64-bit Pointers and Array Indexing with 32-bit Integers
Date: 1995/04/19	[thread overview]
Message-ID: <3n39kg$aeh@jac.zko.dec.com> (raw)
In-Reply-To: 3n0tcu$t09@news.sandia.gov


In article <3n0tcu$t09@news.sandia.gov>, jrredho@sandia.gov (John Red-Horse) 
writes:
|>We're currently in the porting stage for a Fortran-based memory management
|>package that I support and a curious question came to mind:  How does the
|>Fortran compiler access array locations by integer indexing that overflow
|>32 bits?  I have a motivation for stating the problem this way, but the
|>fact is not all array accesses are done via processes like DO loops
|>(which, I guess, one could internally convert to pointer arithmetic on the
|>fly).  For example, I might compute the array location by doing some
|>integer arithmetic on an index.

It does the indexing calculation in 64 bits.

Probably not relevant to your specific question, but relevant in general to
64-bit array indexing, is the following excerpt from the DEC Fortran
release notes:

2.3  Static Array Offsets Must Be Smaller than 32-bit Integers -
     Dynamic Offsets May Exceed 32-bit Values

There is a restriction currently in the DFAO compiler.  The restriction is
that an array offset for a statically allocated array must fit in 32 bits
(signed).  An "array offset" is the byte offset from the array's virtual origin.

This restriction goes along with the restriction that no addressable statically
allocated object, eg, array or COMMON block, can be bigger (in bytes) than
32-bits.

Array index calculations in DFAO V3.4 and later are done using 64-bit integer
calculations (V3.3 used 32-bit arithmetic for these calculations).

This means that you can have dynamically-allocated arrays that exceed 2**31
bytes in total size (arrays whose storage is gotten by calling malloc, for
example).

It is *not* yet possible to have statically allocated arrays this large.  You
can't declare an array larger than 2**31 bytes in total size.  These are *not*
supported:
        INTEGER BIG_ARRAY_1D (2**30)
        INTEGER BIG_ARRAY_2D (2**26, 32)

The same restriction applies to adjustable arrays.  For example, this is *not*
supported:
        CALL SUB (A, 2**26, 32, 10)
        ...
        SUBROUTINE SUB (A, I, J, K)
        INTEGER*8 I,J,K
        REAL A (I,J,K)

This is ok:
        CALL SUB (A, 2**33)
        ...
        SUBROUTINE SUB (A, A_SIZE)
        INTEGER*8 A_SIZE
        REAL A (1)

-- 

Steve Lionel                      Mail: lionel@quark.enet.dec.com
DEC Fortran Development           WWW:  http://www.digital.com/info/slionel.html
Digital Equipment Corporation     CompuServe: 75263,3001
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698             "Free advice is worth every cent"

For a summary of Digital's Internet services, send mail to info@digital.com



      reply	other threads:[~1995-04-19  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-04-18  4:00 64-bit Pointers and Array Indexing with 32-bit Integers John Red-Horse
1995-04-19  4:00 ` Steve Lionel [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox