Indicates whether a program contains certain categories of aliasing or does not conform to Fortran standard aliasing rules. The compiler limits the scope of some optimizations when there is a possibility that different names are aliases for the same storage location.
.-:--------------. | .-std--------. | | +-pteovrlp---+ | | +-nointptr---+ | V +-aryovrlp---+ | >>- -q--alias--=----+-noaryovrlp-+-+--------------------------->< +-intptr-----+ +-nopteovrlp-+ '-nostd------'
@PROCESS:
@PROCESS ALIAS( {ARGUMENT_LIST} )
-qalias=aryovrlp:nointptr:pteovrlp:std
Because this option inhibits some optimizations of some variables, using it can lower performance.
Programs that contain nonstandard or integer POINTER aliasing may produce incorrect results if you do not compile them with the correct -qalias settings. When you use the xlf or xlf_r invocation command to compile the .f, .F, .f77, or .F77 files, or when you use the f77 or fort77 invocation command, the compiler assumes that integer POINTERs might be present (-qalias=aryovrlp:pteovrlp:std:intptr). All the other invocation commands assume that a program contains only standard aliasing (-qalias=aryovrlp:pteovrlp:std:nointptr).
If the following subroutine is compiled with -qalias=nopteovrlp, the compiler may be able to generate more efficient code. You can compile this subroutine with -qalias=nopteovrlp, because the integer pointers, ptr1 and ptr2, point at dynamically allocated memory only.
subroutine sub(arg)
real arg
pointer(ptr1, pte1)
pointer(ptr2, pte2)
real pte1, pte2
ptr1 = malloc(%val(4))
ptr2 = malloc(%val(4))
pte1 = arg*arg
pte2 = int(sqrt(arg))
arg = pte1 + pte2
call free(%val(ptr1))
call free(%val(ptr2))
end subroutine
If most array assignments in a compilation unit involve arrays that do not overlap but a few assignments do involve storage-associated arrays, you can code the overlapping assignments with an extra step so that the NOARYOVRLP suboption is still safe to use.
@PROCESS ALIAS(NOARYOVRLP)
! The assertion that no array assignments involve overlapping
! arrays allows the assignment to be done without creating a
! temporary array.
program test
real(8) a(100)
integer :: j=1, k=50, m=51, n=100
a(1:50) = 0.0d0
a(51:100) = 1.0d0
! Timing loop to achieve accurate timing results
do i = 1, 1000000
a(j:k) = a(m:n) ! Here is the array assignment
end do
print *, a
end program
! We cannot assert that this unit is free
! of array-assignment aliasing because of the assignments below.
subroutine sub1
integer a(10), b(10)
equivalence (a, b(3))
a = b ! a and b overlap.
a = a(10:1:-1) ! The elements of a are reversed.
end subroutine
! When the overlapping assignment is recoded to explicitly use a
! temporary array, the array-assignment aliasing is removed.
! Although ALIAS(NOARYOVRLP) does not speed up this assignment,
! subsequent assignments of non-overlapping arrays in this unit
! are optimized.
@PROCESS ALIAS(NOARYOVRLP)
subroutine sub2
integer a(10), b(10), t(10)
equivalence (a, b(3))
t = b; a = t
t = a(10:1:-1); a = t
end subroutine
When SUB1 is called, an alias exists between J and K. J and K refer to the same item in storage. In Fortran, this aliasing is not permitted if J or K are updated, and, if it is left undetected, it can have unpredictable results.
CALL SUB1(I,I)
…
SUBROUTINE SUB1(J,K)
INTEGER BIG(1000)
INTEGER SMALL(10)
COMMON // BIG
EQUIVALENCE(BIG,SMALL)
…
BIG(500) = 5
SMALL (I) = 6 ! Where I has the value 500
J = BIG(500)