Guardian Application Conversion Guide
General-Case Variances
Converting to TNS/R Systems
096047 Tandem Computers Incorporated 9–5
Stack Wrapping If a nonprivileged program tries to allocate variables past the end of the user data
segment, results might differ depending on the system:
On TNS processors, the allocation wraps back to the user data segment.
On TNS/R processors, the allocation is unpredictable; it might wrap or trap.
Remove any constructs that result in stack wrapping. Change addressing operations
so that they stay within the user data segment.
The following examples show addressing operations that might not wrap back on the
stack on TNS/R processors as they do on TNS processors.
STRUCT s(*);
BEGIN
INT i;
INT(32) d;
INT j;
END;
PROC exam;
BEGIN
INT .p (s);
STRUCT s2(s);
@p := -1; !-1 = 65535 (unsigned); structure starts
! at the end of the user data segment
s2 ':=' p FOR $LEN(s2) BYTES; !On TNS/R systems,
p.d := %h12345678%d; ! these operations
p.j := 6; ! might wrap or trap
END;
On TNS processors, structure P starts at the end of the user data segment and wraps
back to G[0], as shown by the dotted line in the following figure. On TNS/R
processors, structure P might wrap or trap.
G [0]
G [65535]
SG [0]
User Data Segment
(Relative Segment 0)
System Data Segment
(Relative Segment 1)
P
902