Pointers to Half-Word Aligned Data Items [ HP C/iX Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Reference Manual
Pointers to Half-Word Aligned Data Items
Pointers in HP C for the HP 3000 Series 900 by default point to objects
aligned on 32-bit word addresses. By default, the machine instructions
for pointers generated by the compiler depend on the data being word
aligned. A run-time memory fault occurs if a pointer to a word-aligned
data item accesses a half-word (16-bit) aligned data item. Using
non-natively aligned structures can produce this situation.
In the following example, a run-time memory fault occurs under normal
conditions because pi points to a half-word aligned field.
#pragma HP_ALIGN MPE_16
struct { char a; int b; } c;
int *pi;
pi = &c.b; /* Now pi points to a half-word aligned integer. */
The +u compiler option resolves this by causing the compiler to generate
code to access pointers with half-word addressing.
For best performance you should encapsulate this option, and after
reading a data item into a half-word aligned structure, immediately copy
the contents, member by member to a word aligned structure.
MPE/iX 5.0 Documentation