bug-marst
[Top][All Lists]
Advanced

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

Re: bug in Marst assignment


From: Andrew Makhorin
Subject: Re: bug in Marst assignment
Date: Sun, 10 Aug 2003 20:50:15 +0400

>I believe there is a bug in the implicit type conversion from integer to
>real in simple assignment statements involving arrays.  The following
>program generates the marst compiler error.  The same program runs
>properly in Erik Schoenfelder's a60 interpreter.
>
>begin
>  integer i;
>  real array a[1:10];
>
>  for i := 1 step 1 until 10 do
>    begin
>      a[i] := i;
>      outreal(1,a[i])
>    end
>end
>
>marst testarray.a60
>
>testarray.a60:8: different types in left part list of assignment statement
>testarray.a60:10: one error detected on the second pass; translation
>  terminated

Thank you very much for your bug report!

In fact, this is a stupid bug: the marst translator thinks that in the
context a[i] := i; the identifier i is still the left part of the
assignment statement (i.e. as if there were a[i] := i := ...), while it
is a final expression in the right part.

In order to fix the bug please insert two lines into the file marst.c
(the version 2.4) as follows:

3219                 x->type = F_REAL;
3220              }
                  /* x is final expression, so clear lvalue flag */
                  x->lval = 0;
3221  skip3:      ;
3222           }
3223        }

After patching marst.c I tried your example, and it said to me:

1 2 3 4 5 6 7 8 9 10

Correct? :+)


- Andrew Makhorin





reply via email to

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