
{: test that the pack function causes a fatal error if
   there is a range error with a conformant array parameter }

{$d+}
program d107( output );

type lowCase =  'a'..'z';
var
   a  : array['a'..'z'] of lowCase;
   pa : packed array[1..4] of char;
   c  : char;

function side : char;
begin
   side := c;
   c := succ(c);
end;

procedure p( var a : array[c0..c1 : char] of lowCase;
             var pa : packed array[i0..i1 :integer ] of char
            );
begin
   c := 'a';
   pack( a, side, pa );
   if c <> 'b' then
      writeln( 'pack for debug has side effects' );

   pack( a, pred('a'), pa ); { range error }
   writeln( 'fails: pack range error not detected' );
end; { p }

begin {d107}
   p(a, pa);
end. { d107 }

