HP C Programmer's Guide (92434-90009)

106 Chapter4
Optimizing HP C Programs
Aliasing Options
Each field of a structure type is placed in a separate equivalent group which is distinct
from the equivalent group of the field's base type. (The assumption here is that a
pointer to int will not be assigned the address of a structure field whose type is int).
The actual type name of a structure type is not considered significant in constructing
equivalent groups (e.g., dereferences of a struct foo pointer and a struct bar pointer
will be assumed to alias with each other even if struct foo and struct bar have
identical field declarations).
All fields of a union type are placed in the same equivalent group, which is distinct from
the equivalent group of any of the field's base types. (Thus, all dereferences of pointers
to a particular union type will be assumed to alias with each other, regardless of which
union field is being accessed.)
Address-exposed array variables are grouped into the equivalent group of the array
element type.
Explicit pointer typecasts applied to expression values will be honored in that it would
alter the equivalent group associated with an ensuing use of the typecast expression
value. For example, an int pointer that is first typecast into a float pointer and then
dereferenced will be assumed to potentially access objects in the float equivalent group
and not the int equivalent group. However, type-incompatible assignments to pointer
variables will not alter the aliasing assumptions on subsequent references of such
pointer variables.
In general, type incompatible assignments can potentially invalidate some of the
type-safe assumptions, and such constructs may elicit compiler warning messages.
NOTE
Variables declared to be of type void * need to be typecast into a pointer to a
specific type before they can be dereferenced.