[Oberon] Bug? procedure variable in procedure call parameter
Peter De Wachter
pdewacht at gmail.com
Mon Mar 31 20:22:11 CEST 2014
There were serious bugs with floating point code in the image and in the
emulator. That's probably the cause of your problem. Paul Reed published
a fixed image last Friday and the emulator bugs are fixed in the current
revision.
On 31-03-14 19:17, Volkert Barr wrote:
> Dear all,
>
> i have a "problem" with the evaluation of a "procedure variable" used as parameter in a procedure call.
>
> this case leads to a ABORT or TRAP in Line 1. Procedure variable is FunId.
>
> BEGIN
> (*1*) Texts.WriteRealFix(W, FunId(1.0), 5,3);
> ...
> END...
>
> this case with the dummy assigment to "Test" gives the correct output
> BEGIN
> Test := FunId(1.0);
> Texts.WriteRealFix(W, FunId(1.0), 5,3);
> ...
> END...
>
> The complete code can be found in the appended Module
>
> Bug or Feature??
>
> I use the Oberon-Image (RISC.IMG) from Paul Reed´s "Project Oberon"-Website with the nice "Oberon RISC Emulator" from Peter De Wachter (thanks for it).
>
> BW,
> Volkert
> ----
>
> MODULE Scratch;
> IMPORT Texts, Oberon;
>
> TYPE Function = PROCEDURE (x:REAL) : REAL;
>
> VAR W: Texts.Writer;
> FunId : Function;
>
> PROCEDURE RealId(x:REAL):REAL;
> BEGIN
> RETURN x
> END RealId;
>
>
> PROCEDURE DoIt*;
> VAR
> Test : REAL;
> BEGIN
> Test := FunId(1.0);
> Texts.WriteRealFix(W, FunId(1.0), 5,3);
> Texts.WriteRealFix(W, RealId(1.0), 5,3);
> Texts.WriteLn(W);
> Texts.Append(Oberon.Log, W.buf)
> END DoIt;
>
> BEGIN Texts.OpenWriter(W);
> FunId := RealId;
> END Scratch.
>
>
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
More information about the Oberon
mailing list