Sun Studio 12: C++ User's Guide

A.2.105 -xalias_level[=n]

(SPARC) The C++ compiler can perform type-based alias-analysis and optimizations when you specify the following command:

char 

short int 

long int 

float 

signed char 

unsigned short int 

unsigned long int 

double 

unsigned char 

int 

long long int 

long double 

wchar_t 

unsigned int 

unsigned long long int 

enumeration types 

data pointer types 

function pointer types 

data member pointer types 

function member pointer types 

is only accessed through lvalues of the following types:

A.2.105.1 Defaults

If you do not specify -xalias_level, the compiler sets the option to -xalias_level=any. If you specify -xalias_level but do not provide a value, the compiler sets the option to -xalias_level=compatible.

Interactions

The compiler does not perform type-based alias analysis at optimization level -xO2 and below.

Warning

If you are using reinterpret_cast or an equivalent old-style cast, the program may violate the assumptions of the analysis. Also, union type punning, as shown in the following example, violates the assumptions of the analysis.


union bitbucket{
  int i;
  float f;
};

int bitsof(float f){
bitbucket var;
var.f=3.6;
return var.i;
}