Sun Studio 12: C++ User's Guide

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;
}