loc(3I)
LOC - Obtains the word address of a variable
As shipped in IRIX 6.5. First release of IRIX 6.5.
NAME LOC - Obtains the word address of a variable SYNOPSIS LOC ([I=]i) IMPLEMENTATION UNICOS, UNICOS/mk, and IRIX systems STANDARDS CF90 and MIPSpro 7 Fortran 90 compiler extension to Fortran 90 DESCRIPTION LOC returns the address of a variable, constant, or array. On UNICOS systems, the address returned is a word address. On UNICOS/mk and IRIX systems, the address returned is a byte address. It accepts the following arguments: i The address to be returned. Specify a variable or constant of Boolean, integer, real, logical, complex, Cray pointer, or character type. LOC can be used to define a Cray pointer. Just like a variable in common storage, a Cray pointee, Cray pointer, or the i argument to LOC is stored in memory before a call to an external procedure and is read out of memory at its next reference. The variable is also stored before a RETURN or END statement of a subprogram. The name of this intrinsic cannot be passed as an argument. WARNINGS LOC is often used to compute the difference of two addresses as an offset. The offset is then used to access one of the arrays by overindexing the other array. UNICOS/mk systems, unlike UNICOS systems, have several address spaces (called memory segments), and memory references with offsets outside of the segment are not allowed. If the arrays are in different memory segments, the corresponding offset generates memory references outside of the segment. These references cause run-time Translation Not Valid errors. RETURN VALUES The value returned is of type Cray pointer. EXAMPLES Example 1: Consider the following code: SUBROUTINE SUB(N) COMMON POOL(100000) INTEGER BLK(128), WORD64 REAL A(1000), B(N), C(100000-N-1000) POINTER(PBLK,BLK),(IA,A),(IB,B),(IC,C),(ADDRESS,WORD64) DATA ADDRESS /64/ PBLK = 0 IA = LOC(POOL) IB = IA + 1000 IC = IB + N In effect, WORD64 in this example refers to the contents of absolute address 64; BLK is an array occupying the first 128 words of memory; A is an array of length 1000 located in blank common; B follows A and is of length N; C follows B. A, B, and C are associated with POOL. Similarly, WORD64 is the same as BLK(65), because BLK(1) is at address 0. Example 2: Consider the following code: POINTER (P,B),(P,C) REAL X,B,C P = LOC(X) B = 1.0 C = 2.0 PRINT *,B Because B and C have the same Cray pointer, the assignment of 2.0 to C gives the same value to B; therefore, B will print as 2.0 even though it was assigned 1.0. SEE ALSO Intrinsic Procedures Reference Manual, publication SR-2138, for the printed version of this man page.