{: test that assigning to a set outside its bounds causes a fatal error
   test bounds error at upper set boundary for 
              set - set 
}

{ this is a generic test, many versions of this test will be built with
  cpp -D ARG1=ARG -D ARG2=(ARG+ADJ)
  for all combinatiopns of ARG & ADJ

ARG   -17 -16 -15 -1 0 2 15 16 17
ADJ   1 7 8
}

{$d+}
program d251( output );
const
   top = 40;
   lo  = -30;
   hi  = ARG1;
   eltest = ARG2;
var
   i, j, k : integer;
   s0      : set of lo..hi;    {dst}
   s1, s2  : set of -top..top; {src}

begin {d251}
   j := eltest;
   i := lo; k := hi; {min,max element of s0}
   s1 := [i-1..j+1, i..i+4, hi-4, hi]; 
   s2 := [i-1,k+1..j+1, i+4, hi-4];
   writeln( 'INFO: s0 is [', lo:1, '..', hi:1, ']' );{}
   s0 :=  s1 - s2 ;       {OK}
   s2 := [lo+4, k-4, i-1,k+1..j]; 
   s0 :=  s1 - s2 ;   {!!! assignment outside bounds}
   writeln('failed to detect set assign error');
end. { d251 }
