issue with returning a local variable by reference.
There is no check that a local variable or parameter is being returned (for a variable parameter, returning by reference is acceptable)
MODULE Test;
TYPE
R = RECORD
PROCEDURE P*(): VAR INTEGER;
VAR i: INTEGER;
BEGIN
RETURN i;
END P;
PROCEDURE Q*(i: INTEGER): VAR INTEGER;
BEGIN
RETURN i;
END Q;
PROCEDURE X*(CONST i: INTEGER): VAR INTEGER;
BEGIN
RETURN i;
END X;
PROCEDURE Y*(VAR i: INTEGER): VAR INTEGER;
BEGIN
RETURN i; (* OK *)
END Y;
END;
END Test.