pTAL Reference Manual (H06.03+)
HP pTAL Reference Manual—523746-005
4-1
4 Data Alignment
In native mode, a data item is aligned if its address is a multiple of its size. For
example, a 4-byte data item is aligned if its address is a multiple of four. An address
that is not aligned is called misaligned. In native mode, a compiler requires data to be
aligned unless otherwise indicated. Unexpected misalignment causes the program to
run slowly, but usually with the expected results.
The only time a nonprivileged program running in TNS/R native mode could have data
alignment problems is when calling the atomic routines whose names begin with
“$ATOMIC_”. Those routines operate correctly only when given aligned operand
addresses. This section explains some ways to diagnose bad calls at run time.
TNS-compiled programs must follow more stringent alignment rules, which apply to all
data. Those rules are explained in:
Topics:
•
Misalignment Tracing Facility on page 4-1
•
Misalignment Handling on page 4-3
Misalignment Tracing Facility
The misalignment tracing facility is enabled or disabled on a system-wide basis (that is,
for all processors in the node). By default, it is enabled (set to ON). It can be disabled
(set to OFF) only by the persons who configure the system, by means of the
Subsystem Control Facility (SCF) attribute MISALIGNLOG. Instructions are in the SCF
Reference Manual for the Kernel Subsystem.
Product T Number Document
Accelerator T9276 Accelerator Manual Data Alignment Addendum
TNS C T9255 C/C++ Programmer’s Guide
TNS C++ T9541 C/C++ Programmer’s Guide
TNS c89 T8629 C/C++ Programmer’s Guide
TNS COBOL T9257 COBOL Manual for TNS and TNS/R Programs
TAL T9250 TAL Programmer’s Guide Data Alignment Addendum
Note. HP recommends that the MISALIGNLOG attribute be left ON (its default setting) so that
a process
that is subject to rounding of misaligned addresses generates log entries, facilitating
diagnosis and repair of the code. Only if the volume of misalignment events degrades
performance should this attribute be turned OFF.










