[Oberon] Compiler differences

Bob Walkden bob at web-options.com
Tue Sep 20 00:08:41 CEST 2005


Hi,

I have recently downloaded the SpreadSheets Gadget package from the ETH FTP
site. In ETH Plugin Oberon for Windows 2.4 it compiles and runs ok. On
Native Oberon 2.3.6 running on a Thinkpad 760ED it compiles (with the \2
switch) but Traps with an index overflow.

The source code is exactly the same on both machines, of course. It is
failing in this bit:

PROCEDURE InitSpreadModel*(obj: SpreadModel);
VAR
	i, j: INTEGER;
BEGIN
	obj.handle := SpreadModelHandler;
	obj.width := 2;
	obj.height := 2;
	NEW(obj.table, obj.width + 1, obj.height + 1);
	FOR i := 0 TO obj.width DO
		FOR j := 0 TO obj.height DO
			obj.table[i, j] := NIL   <------ Trap here
		END
	END
END InitSpreadModel;

This makes a 3x3 spreadsheet.
Here this is the definition of SpreadModel:

TYPE
	Table = POINTER TO ARRAY OF ARRAY OF Cells.Cell;

	(** Model for a SpreadSheet object *)
	SpreadModel* = POINTER TO SMDesc;
	SMDesc* = RECORD (Gadgets.ObjDesc)
		width, height: INTEGER;		(* width and height of the
table *)
		table: Table		(* the table with the cells *)
	END;

As far as I can see, there is no way that code should cause a Trap, so I'm
assuming there are some differences between the compilers that are causing
the different behaviours, and that I perhaps need some switch to eliminate
the differences. However, I can't trace such a switch (I don't want to
compile without range checks).

Any ideas?

--
Regards,
 Bob 




More information about the Oberon mailing list