-qalias

Description

Instructs the compiler to apply aliasing assertions to your compilation unit. The compiler will take advantage of the aliasing assertions to improve optimizations where possible, unless you specify otherwise.

Syntax

Read syntax diagramSkip visual syntax diagram                  .-:---------------.
                  | .-noaddrtaken-. |
                  | +-noallptrs---+ |
                  | +-typeptr-----+ |
                  V +-ansi--------+ |
>>- -q--alias--=----+-noansi------+-+--------------------------><
                    +-notypeptr---+
                    +-allptrs-----+
                    '-addrtaken---'

where available aliasing options are:

[NO]TYPeptr If notypeptr is specified, pointers to different types are never aliased. In other words, in the compilation unit, no two pointers of different types will point to the same storage location.
[NO]ALLPtrs If noallptrs is specified, pointers are never aliased (this also implies -qalias=typeptr). Therefore, in the compilation unit, no two pointers will point to the same storage location.
[NO]ADDRtaken If noaddrtaken is specified, variables are disjoint from pointers unless their address is taken. Any class of variable for which an address has not been recorded in the compilation unit will be considered disjoint from indirect access through pointers.
[NO]ANSI If ansi is specified, type-based aliasing is used during optimization, which restricts the lvalues that can be safely used to access a data object. The optimizer assumes that pointers can only point to an object of the same type. This (ansi) is the default for the xlc xlC, and c89 compilers. This option has no effect unless you also specify the -O option.

If you select noansi, the optimizer makes worst case aliasing assumptions. It assumes that a pointer of a given type can point to an external object or any object whose address is already taken, regardless of type. This is the default for the cc compiler.

Notes

The following are not subject to type-based aliasing:

Example

To specify worst-case aliasing assumptions when compiling myprogram.c, enter:

xlc myprogram.c -O -qalias=noansi

Related information