Object Code Accelerator Manual
Preparing Your Program for TNS/E Systems
Object Code Accelerator Manual—528144-003
2-11
Shift Instructions With Dynamic Shift Counts
Required Change
•
Remove odd-byte references to doublewords and quadruplewords from your
programs.
Recommended Changes
•
Use pointer conversions as recommended for the source code language so that
TNS word instructions are never applied to odd-byte addresses.
•
Set the system’s SCF attribute TNSMISALIGN to either FAIL or NOROUND (see
Table 2-1 on page 2-15). FAIL can be unsafe on production systems, but is
recommended on test systems.
•
Remove odd-byte references to words from your programs.
Examples
•
The results of the following program fragment are unpredictable on TNS/E
systems.
REAL(64) .EXT RPTR;
STRING .EXT SPTR = RPTR; ! Same pointer as RPTR
@SPTR := @SPTR + 1d;
IF SPTR = 'Z' THEN ... ! OK
IF RPTR = 0.0L0 THEN ... ! Results are unpredictable
•
In the following example, an odd-byte address alignment error occurs on a TNS/E
system because the program illegally references a nil pointer. The extended
pointer P contains a byte address. When P is set to -1, the structure starts on an
odd-byte boundary; therefore, the program might trap or it might continue
executing.
STRUCT s(*);
BEGIN
INT i;
INT(32) d;
INT j;
END;
PROC test;
BEGIN
INT .EXT p(s);
@p:= -1d; ! "nil" 4-byte pointer to structure
p.d := %habcd1234%d; ! Results are unpredictable
END;
Shift Instructions With Dynamic Shift Counts
The implementation of TNS instructions for signed arithmetic and unsigned logical
shifts with dynamic shift counts differs between TNS and TNS/E systems. This