Problems with Segmented Address Types

Product Version(s): 3.20
Operating System:   MS-DOS
Flags: ENDUSER | TAR50072 buglist3.20 fixlist3.30
Last Modified: 20-OCT-1988    ArticleIdent: Q10401

There is a problem with address types and long-heap allocation. The
code below contains the constant declaration "const newnil=ptr(0,0)"
and uses it in an if statement. The program should execute the else
part of the if statement and print out that "t^.nest^.back" and t are
equal. However, instead of executing the else part of the if statement
(so it would think the addresses are different), the program prints
out that the addresses are the same.

Microsoft has confirmed this to be a problem in Version 3.20. This
problem was corrected in Version 3.30.

The following is the short sample code:

   program test(input,output);
   type ptr = ads of word;
   p_somestruct = ads of somestruct;
   somestruct = record
   NEXT:p_somestruct;
   BACK:p_somestruct;
   end;
   const newnil = ptr(0,0);
   VAR t : p_somestruct;

   FUNCTION GETMQQ(WANTS : word) : adsmem; extern;

   begin
   t := getmqq(sizeof(t^));
   t^.next := getmqq(sizeof(t^.next^));
   t^.next^.back := t;
   if t^.next <> newnil then
   if t^.next^.back <> t then
   begin
   writeln('test says T^.NEXT^.BACK and T are not equal, BUT...');
   writeln('T^.NEXT^.BACK=',T^.NEXT^.BACK.S,T^.NEXT^.BACK.R);
   WRITELN('T =',t.s,t.r);
   end
   else
   writeln('T^.NEXT^.BACK and T are equal');
   end.
