When it assumes that code is well-behaved, the
compiler can be less conservative in generating code for pointer-based
objects. Well-behaved code follows these rules:
. The address of a union member is never
assigned to a pointer.
. A value of a pointer type is never cast to
an incompatible pointer type.
Given these assumptions, the compiler might be able
to generate substantially better code in referencing pointer-based variables.
The compiler issues an appropriate warning if either of these assumptions is violated
in such a way as to affect assumptions made by the optimizer. You must decide
whether the warnings can be safely ignored or whether the program should be
compiled at a lower optimization level.
Caution: The compiler might not catch all instances
of misbehaved code. For example, a pointer-to-char might be passed to an undeclared
(unprototyped) external function expecting a pointer-to-int. Therefore, it is
possible for a program to compile at optimization level 6 without warnings
(and run incorrectly), but run correctly when compiled at a lower
optimization level.
You can manually request this optimization by
turning On toggle Behaved.
|