Consider the following example source code.
struct foo {
short f1;
short f2;
int f3;
} *fp;
struct bar {
int b1;
int b2;
} *bp;
union moo {
struct foo u_f;
struct bar u_b;
} u;The compiler’s assumptions based on various alias levels are the following:
If this example is compiled with the -xalias_level=weak option, fp->f3 and bp->b2 can alias each other.
If this example is compiled with the -xalias_level=layout option, no fields can alias each other.
If this example is compiled with the -xalias_level=strict option, fp->f3 and bp->b2 can alias each other.
If this example is compiled with the -xalias_level=std option, no fields can alias each other.