Guardian Application Conversion Guide

General-Case Variances
Converting to TNS/R Systems
9–6 096047 Tandem Computers Incorporated
Odd-Byte References TNS/R systems do not support the same odd-byte references to doublewords (4-byte
units) or quadruplewords (8-byte units) as TNS systems do. Odd-byte references are
made when the least significant bit (bit 31) of an extended pointer is set.
TNS systems ignore bit 31 of an extended pointer and fetch or store data starting
from the byte prior to the addressed one to ensure that the address is on a word
boundary. This behavior is probably not what you intended.
On TNS/R systems, odd-byte references to doublewords or quadruplewords are
unpredictable; programs might trap or they might continue executing. Extended
pointers to variables accessed as doublewords or quadruplewords must not have their
least significant bit set. If your program was written following good TAL
programming practices, odd-byte references are not a concern.
In TAL, data types stored as doublewords or quadruplewords include INT(32),
FIXED(n), INT(64), REAL, and REAL(64). In C, data types stored as doublewords or
quadruplewords include long, unsigned long, long long, float, and double.
To correct your program, remove odd-byte references to doublewords or
quadruplewords. Also, make sure that all pointers contain addresses. Many odd-byte
references to doublewords and quadruplewords are caused by uninitialized pointers.
(%37777000000D, the null address, is an appropriate value to use for initializing a
pointer until it is given another address.)
The results of the following example are unpredictable on a TNS/R system:
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 alignment error occurs on a TNS/R system
because the program refers to 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. 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 32-bit pointer to structure
p.d := %habcd1234%d; !Results are unpredictable
END;