I have a piece of code that does not follow my understanding of pascal. As I don't want to bother you in reading long code, here is a tiny model, that (mis)behave the same. 1=1 and 1=2 are to avoid discussing "when it does occur" or "once it stopped". I just don't know wether it is a bug or an error of mine.
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.
As I understand it, once reached line 7 (the 'for' loop), the following instruction ('if then') is executed ten times, so the output consists in a row of ten stars as the 1=1 is always true. Then the 'repeat until' loop is executed, forever since 1 never equals 2. It is not obvious the programme does not work if one executes it, but the debugger will betray another behaviour (if you change something in the structure, it is not certain it will still "not work"). 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.
If it is some kind of bug, I theoretically use last GPC beta version.
Cheers.
F.P.L