Hello everyone, 
 
Attached is a program that illustrates misbehaviour: second assert fails as n
gets 4. Commented are actions to make it work properly. It has something to do
with first line of case probably. Please, take a look. 

Checked with FPC 2.2.0, 2.3.1, svn trunk.

System is: "Linux 2.6.20-17-generic #2 SMP Mon Jun 9 22:08:13 UTC 2008 i686 
GNU/Linux"

Thanks in advance, 

--Pavel. 

program pcase (Output);

procedure t1();
var 
  n : 2..5; {works with 1..5, 0..5, doesn't with 2..5, 3..5, 4..5}
begin
  n := 3; 
  assert( n = 3, 't1: n should be initialized to 3' );
  case n of
    1,2 :  Writeln ('branch 1,2' ); {works with these branches removed or changed}
    3: begin Writeln ('branch 3'); n := 3; end;
    4: begin Writeln ('branch 4'); n := 4; end;
  end;
  assert( n = 3, 't1: n should remain 3' );
end;

begin
  t1;
end.

_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to