3.4.107 –xalias[=keywords]
Specify degree of aliasing to be assumed by the compiler.
Some non-standard programming techniques can introduce situations that interfere with
the compiler’s optimization strategies. The use of
overindexing,
pointers, and passing global or non-unique variables as subprogram arguments, can
introduce ambiguous aliasing situations that could result code that does not work as
expected.
Use the -xalias flag to inform the compiler about the degree to which the
program deviates from the aliasing requirements of the Fortran standard.
The flag may appear with or without a list of keywords. The
keywords list is comma-separated, and each keyword indicates an aliasing
situation present in the program.
Each keyword may be prefixed by no% to indicate an aliasing type that is
not present.
The aliasing keywords are:
Table 3-12 -xalias Option Keywords
|
|
dummy
|
Dummy (formal) subprogram parameters can alias each other and global variables.
|
no%dummy
|
(Default). Usage of dummy parameters follows the Fortran standard and do not alias each other
or global variables.
|
craypointer
|
(Default). Cray pointers can point at any global variable or a local variable whose address is
taken by the LOC() function. Also, two Cray pointers might point at the same
data. This is a safe assumption that could inhibit some optimizations.
|
no%craypointer
|
Cray pointers point only at unique memory addresses, such as obtained from
malloc(). Also, no two Cray pointers point at the same data. This assumption
enables the compiler to optimize Cray pointer references.
|
actual
|
The compiler treats actual subprogram arguments as if they were global variables. Passing an
argument to a subprogram might result in aliasing through Cray pointers.
|
no%actual
|
(Default) Passing an argument does not result in further aliasing.
|
overindex
|
-
A reference to an element in a COMMON block might refer to any element in a COMMON block or
equivalence group.
-
Passing any element of a COMMON block or equivalence group as an actual argument to a
subprogram gives access to any element of that COMMON block or equivalence group to the called
subprogram.
-
Variables of a sequence derived type are treated as if they were COMMON blocks, and elements
of such a variable might alias other elements of that variable.
-
Individual array bounds may be violated, but except as noted above, the referenced array
element is assumed to stay within the array. Array syntax, WHERE, and
FORALL statements are not considered for overindexing. If overindexing occurs in
these constructs, they should be rewritten as DO loops.
|
no%overindex
|
(Default) Array bounds are not violated. Array references do not reference other
variables.
|
ftnpointer
|
Calls to external functions might cause Fortran pointers to point at target variables of any
type, kind, or rank.
|
no%ftnpointer
|
(Default) Fortran pointers follow the rules of the standard.
|
|
Specifying -xalias without a list gives the best performance for most
programs that do not violate Fortran aliasing rules, and corresponds to:
no%dummy,no%craypointer,no%actual,no%overindex,no%ftnpointer
To be effective, -xalias should be used when compiling with optimization
levels -xO3 and higher.
The compiler default, with no -xalias flag specified, assumes that the
program conforms to the Fortran standard except for Cray pointers:
no%dummy,craypointer,no%actual,no%overindex,no%ftnpointer
Examples of various aliasing situations and how to specify them with
-xalias are given in the Porting chapter of the Fortran Programming
Guide.