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

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Mon Oct 18 08:38:45 CEST 2021


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)?








More information about the Oberon mailing list