References Off to Windows Procedure Variable in Version 3.20

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

There is a problem in the following code with the statement "D31 := n
+ x". When attempting to reference a nested variable (x) of a Windows
procedure, the offset of "x" is off by 2 bytes due to the Windows
entry sequence that pushes DS before allocating local memory.

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

The following is a short example code:

    {$stackseg+}
    module death;
    type
       deaths_head=record
         X,Y:integer;
         DATA:lstring(255);
         end;

    PROCEDURE D1(D:deaths_head)[public,windows];
    begin
      D.X:=d.y;
    end;

    procedure d2[public,windows];
    VAR DX:deaths_head;
    begin
      d1(dx);
    end;

    procedure d3[public,windows];
    VAR X:integer;
        FUNCTION D31(N:integer):integer;
        begin
           D31:=n+x;
        end;
    begin
      X:=5;
      X:=d31(10);
    end;
    end. {module death}
