gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] Bug in FOR Statement?


From: Juan Reyes
Subject: [Gm2] Bug in FOR Statement?
Date: Sat, 19 Nov 2005 08:20:55 +0100
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050716)

Hi to all,
first of all, thanks for your job on developing this compiler.
I have recently installed the compiler and works fine,
but I found that when I compile and run this code:

MODULE fortest;

FROM InOut IMPORT WriteInt,WriteLn;

  VAR N,i: INTEGER;

BEGIN
 N:=2;
 FOR i:=N TO 1 BY -1 DO
 WriteInt(i,2);
 END;
 WriteLn;
END fortest.


I get this output:

2 1 0

So the FOR statement is evaluated 3 times instead of  2¿?

If in the FOR line you change N by 2 (or a constant), then the output is OK.

The version is 2005-11-15 with gcc 3-3-6.

J.R.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]