Bad code generated for ADS assignment in Version 3.31

Product Version(s):
Operating System:   MS-DOS
Flags: ENDUSER | TAR57668
Last Modified: 25-FEB-1988    ArticleIdent: Q12396

Subject:   Bad code generated for ADS assignment

Product: PASCAL 3.31

Problem:
   Bad code is generated when assigning a element of ADS record to the offset
of an ADS variable.  This problem occurs in versions 3.30 and 3.31.

Response:
   This problem is corrected in the version 3.32 release.

EXAMPLE PROGRAM:

program temp(input, output);

  type
    boxg_rec = record
      next : word;
      case btype : word of
        1   : (l_lit    : word);
        2   : (d_handle : word);
      {end case}
    end{record};

    boxg_ary = array [1..10] of boxg_rec;

  var
    boxgary_ads : ads of boxg_ary;
    i           : integer;

begin
  boxgary_ads^[i].next := (ads boxgary_ads^[i+1]).r;
end.

3.30 and 3.31 produces the following code - for the assignment;

  REPZ
  STOSB

3.20 produces this code.

  MOV       AX,0006H
  MUL       I
  LES       BX,BOXGAR
  ADD       BX,AX
  ADD       AX,FFFAH
  MOV       DX,BX
  LES       BX,BOXGAR
  ADD       BX,AX
  MOV       ES:[BX],DX