According to FPL:
[...]
1 program model(input, output); 2 var 3 i : integer; 4 5 begin 6 repeat 7 for i:=1 to 10 do 8 if 1=1 then 9 writeln('*'); 10 until 1=2; 11 end.
[Debugging the program above ...] Once reached the 'for' statement, only one star is printed then the pointer directely jumps on repeat, not printing ten stars in a row, just one. Nothing is changed in 'begin end;' insertion in the code.
That's not a bug, that's optimization. GPC sees * that "if 1=1" is always true ("if true") and eliminates that line, and * that the program just prints stars forever independent of the counter `i' and eliminates the counting (the `for' loop). This results in repeat writeln ( '*' ); until false; OTOH, if you observe the same behaviour with all optimization turned *off* (i.e. you do not give the `-O' switch to the call to `gpc'), it *is* a bug, not in code generation but in GPC's generation of debugging information. Please let us know which is the case. Greetings, Peter -- Peter Gerwinski, Essen, Germany, http://home.pages.de/~Peter.Gerwinski/ Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-980420 PGP: see homepage - 6C 94 45 BE 28 A4 96 - 0E CC E9 12 47 25 82 75 Fight the SPAM and UBE! - http://spam.abuse.net/ - http://maps.vix.com/