[Oberon] Array Index Out Of Range in ORG.FindPtrFlds

Jörg joerg.straube at iaeth.ch
Sat Oct 23 12:22:19 CEST 2021


Andreas

Ich bin mir nicht ganz sicher, aber sollte es nicht so heissen?
> 
> ELSIF typ.form = ORB.Array THEN FindPtrFlds(typ.base, off, dcw) END

Gruss, Jörg

> Am 18.10.2021 um 08:52 schrieb Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>:
> 
> The following program compilers correctly in FPGA Oberon
> 
>  MODULE M1;
>    TYPE P = POINTER TO R;
>      R = RECORD a: ARRAY 160 OF INTEGER END ;   (*compiles correctly*)
>  END M1.
> 
> but the following program leads to a trap 1 = array index out of range error in ORG.FindPtrFlds
> 
>  MODULE M2;
>    TYPE P = POINTER TO R;
>      R = RECORD a: ARRAY 160 OF P END ;    (*trap 1 = array index out of range*)
>  END M2.
> 
> The reason is, of course, that ORG.data is an ARRAY maxTD (=160) OF INTEGER 
> 
> and ORG.FindPtrFlds traverses each array element individually to compute the offsets
> 
>  ELSIF typ.form = ORB.Array THEN
>    s := typ.base.size;
>    FOR i := 0 TO typ.len-1 DO FindPtrFlds(typ.base, i*s + off, dcw) END   (*<--------*)
> 
> Any suggestions how to address that in program M2 (or in the compiler, other than increasing maxTD)?
> 
> 
> 
> 
> 
> 
> --
> 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