
Known Outstanding bugs
======================

(1)  (5)  (12)  (13)  (18)

Bugs which have been fixed
==========================

(2)  (3)  (4)  (6)  (7)  (8)  (9)  (10)  (11)  (14)  (15)  (16)
(17)

Description
===========

(1) When linking the program gm2l should examine both DEF and MOD
    files - currently it uses the first it finds?? Is this true -
    certainly it fails to link the rtp/ass3 assingment correctly
    (missing modules out (BufferDevice.mod)) if the paths searches
    DEFs first.

    This needs closer examination and fixing!

(2) testcse27 fails. When -Ocse is supplied. ReturnValue is
    not placed directly after the call to a function. The
    Fault lies inside M2SubExp.mod (somewhere).

(3) Math sin/cos/tan etc. Most work but there is a bug which
    is seen if you run testbox in the m2/games/animate directory.
    When the demo is run it works fine until near the end where
    some of the rotations are not happening.

    KV has some code that might also be exhibiting the same bug?
       Comments Keith?

(4) Function parameters are not checked

(5) A procedure that is defined in the DEFINITION module but not EXPORTed
    can be seen by another module as an UNQUALIFIED identifier. This is
    wrong and causes a linkage error. The error should be caught at
    compile time.

(6) Possible to return a function name from a function with a return type INTEGER
    (sflewis 1st years)

(7) procedure reference inside floating point code not detected.
    (sflewis 1st years)

(8) too many errors report, END - expected, and do not specify IF WHILE etc
    (sflewis 1st years)

(9) error messages sometimes point to wrong token (+-n)

(10) when missing an operator the compiler sometimes gives wierd error messages:
     eg:  foo := bar   (12 DIV 3)
                     ^
                     + missing
     used to give INTEGER undefined in SYSTEM.MOD. Wrong!

     now fixed and generates two snapshots of the source code, this statement and
     the declaration for bar and the message:

     prog23.mod:141:symbol is not recognised as a procedure, check declaration

(11) M2OPTIONS was ignored. Now m2f properly passes each option
     through to the compiler

(12) type checking needs fixing.

     (Place is ARRAY[0..9] OF CHAR;)

     WHILE (Place[1] <> 'qqqqqqqqq') AND (Place[2] <> 'qqqqqqqqqq') DO
        Score := 4;

     should fail.

(13) TYPE    RaceRecord = RECORD
                Name    :       ARRAY [0..9] OF CHAR;
                Score   :       INTEGER;
        END; (* Of RECORD *)

        DataArray = ARRAY [1..15] OF RaceRecord;
        InputArray = ARRAY [0..9] OF CHAR;
VAR
        RecordArray : DataArray;
        NumberOfCompetitors : INTEGER;
        Town : InputArray;
        Empty : InputArray;
        Competitor : InputArray;
        Index : INTEGER;
        Max : CARDINAL;
        TempScore : INTEGER;
        Flag : BOOLEAN;

PROCEDURE Initialise;
BEGIN
   FOR Index := 1 TO 15 DO
                RecordArray[Index].Name := '';
                RecordArray[Index].Score := '0';

gives 48 to Score !!!!!!!!!!!!!!


(14)  unterminated comment which starts at top of a module causes the
      compiler to exit without an error message.

(15)  profiling (-p) option causes link failure.




Hi,
  Your list of bug reports have been applied to the compiler.
Keep them rolling in...

Specifically:

   (1)   unterminated comment at start of module now generates an error message.

         Compiling testcomment4.mod
         Pass 1
            Module SYSTEM               : /user/gaius/m2/comp/libs/SYSTEM.def
            Module M2RTS                : /user/gaius/m2/comp/libs/M2RTS.def
            Module MATH                 : /user/gaius/m2/comp/libs/MATH.def
         testcomment4.mod:1:end of file reached in a comment


   (2)   PROCEDURE IsListSizeAvailable (l: LIST) : BOOLEAN ;
         BEGIN
            RETURN( IsAvailable(SIZE(l^))
         END IsListSizeAvailable ;


         and compiler says unsed variable, l, warning.

         This is a very interesting situation, the compiler is half right I suspect!
         in that "l" isn't *really* used (read or written to - SIZE is a pseudo function) -
         - thus the compiler is prompting, requesting for better code... how about:


         PROCEDURE IsListSizeAvailable () : BOOLEAN ;
         BEGIN
            RETURN( IsAvailable(TSIZE(LIST))
         END IsListSizeAvailable ;


         One candidate for discussion in a paper perhaps?

    (3)  parameter types which are not types... (fixed)
         Compiling testtype.mod
         Pass 1
            Module SYSTEM               : /user/gaius/m2/comp/libs/SYSTEM.def
            Module M2RTS                : /user/gaius/m2/comp/libs/M2RTS.def
            Module MATH                 : /user/gaius/m2/comp/libs/MATH.def
            Module testtype             : testtype.mod
         Pass 2
         Pass 3
         testtype.mod:11:the parameter type specified (v) in procedure (foo) was not itself declared as a type
         testtype.mod:8:testtype.mod:
         testtype.mod:MODULE testtype ;
         testtype.mod:
         testtype.mod:
         testtype.mod:TYPE
         testtype.mod:   T = CARDINAL ;
         testtype.mod:
         testtype.mod:VAR
         testtype.mod:   v: T ;
                            ^
         
         testtype.mod:------------------------------------------
         testtype.mod:
         testtype.mod:MODULE testtype ;
         testtype.mod:
         testtype.mod:
         testtype.mod:TYPE
         testtype.mod:   T = CARDINAL ;
         testtype.mod:
         testtype.mod:VAR
         testtype.mod:   v: T ;
         testtype.mod:
         testtype.mod:
         testtype.mod:PROCEDURE foo (a: v) ;
                                ^^^
    (4)  forgetting to EXPORT QUALIFIED symbols now gets caught as an error, rather than a linkage failure!
         

        Compiling testimport.mod
        Pass 1
           Module SYSTEM               : /user/gaius/m2/comp/libs/SYSTEM.def
           Module M2RTS                : /user/gaius/m2/comp/libs/M2RTS.def
           Module MATH                 : /user/gaius/m2/comp/libs/MATH.def
           Module testimport           : testimport.mod
           Module testimport2          : testimport2.def
        Pass 2
        Pass 3
        testimport2.def:3:Unresolved symbol in module, first used at this line
        the following symbols are unknown at the end of module: testimport
        unknown symbol found requested by another modules import (symbols have not been EXPORTed by the appropriate definition module)
            bar
            foo
        testimport2.def:
        testimport2.def:DEFINITION MODULE testimport2 ;
        testimport2.def:
        testimport2.def:PROCEDURE foo ;
                                  ^^^

   (5)  profiling is now fixed, try the -p option to find out where the time is spent when executing
        your different sort routines.


ok here are 3 modules


Invent.def - defines a pointer to a record type
impor.def - imports that and just sets it equla to a different name
impor2.mod - imports from the other two (above) but in one case (a) it is 
still a pointer
however (b) is not ? so what type is variable b ?

[sflewis@moppsy opaque]$ cat Invent.def
DEFINITION MODULE Invent;

EXPORT QUALIFIED Sstring,Date,InventRec;

TYPE
    InventRec = POINTER TO InventObject;
    Date = [800101..991231] ; (*Year Month Day.*)

    InventObject = RECORD
        Description : Sstring ;
        Price : REAL ;
        Code : INTEGER ;
        Created : Date ;
    END ;
    Sstring = ARRAY [0..9] OF CHAR;
END Invent.
[sflewis@moppsy opaque]$ cat Invent.mod 
                                                                              

IMPLEMENTATION MODULE Invent;

END Invent.

[sflewis@moppsy opaque]$ cat impor.def
DEFINITION MODULE impor;

FROM Invent IMPORT InventRec, Sstring, Date;

EXPORT QUALIFIED list_data_type2;

TYPE
(* the same as InventRec;*)
     list_data_type2 = InventRec;
END impor.
[sflewis@moppsy opaque]$ cat impor.mod
IMPLEMENTATION MODULE impor;
END impor.


[sflewis@moppsy opaque]$ cat impor2.mod
MODULE impor2;

FROM Storage IMPORT ALLOCATE,DEALLOCATE,Available;

FROM Invent IMPORT InventRec;
FROM impor IMPORT list_data_type2;

VAR
a : InventRec;
b : list_data_type2;

BEGIN
NEW(a);
 a^.Code := 12;
(* b^.Code := 12;  *)
END impor2.

[sflewis@moppsy opaque]$ m2f !$
m2f impor2.mod
Compiling impor2.mod
Pass 1
   Module SYSTEM               : /usr/local/m2/libs/SYSTEM.def
   Module M2RTS                : /usr/local/m2/libs/M2RTS.def
   Module MATH                 : /usr/local/m2/libs/MATH.def
   Module impor2               : impor2.mod
   Module Storage              : /usr/local/m2/libs/Storage.def
   Module Invent               : Invent.def
   Module impor                : impor.def
Pass 2
Pass 3
impor2.mod:11:warning unused variable (b) in (impor2)
Pass 4
[sflewis@moppsy opaque]$ m2f -l impor2
[sflewis@moppsy opaque]$ a.out


[sflewis@moppsy opaque]$ cat impor2.mod
MODULE impor2;

FROM Storage IMPORT ALLOCATE,DEALLOCATE,Available;

FROM Invent IMPORT InventRec;
FROM impor IMPORT list_data_type2;

VAR
a : InventRec;
b : list_data_type2;

BEGIN
NEW(a);
NEW(b);
 a^.Code := 12;
(* b^.Code := 12;  *)
END impor2.
[sflewis@moppsy opaque]$ m2f !$
m2f impor2.mod
Compiling impor2.mod
Pass 1
   Module SYSTEM               : /usr/local/m2/libs/SYSTEM.def
   Module M2RTS                : /usr/local/m2/libs/M2RTS.def
   Module MATH                 : /usr/local/m2/libs/MATH.def
   Module impor2               : impor2.mod
   Module Storage              : /usr/local/m2/libs/Storage.def
   Module Invent               : Invent.def
   Module impor                : impor.def
Pass 2
Pass 3
/usr/local/m2/libs/Storage.def:23:parameter mismatch
impor2.mod:15:Error found while compiling the program module
problem in parameter   1 :   PROCEDURE ALLOCATE (VAR a: ADDRESS; ...) ;
item being passed is     :   b: list_data_type2
identifier with an incompatible type is being passed to this procedure
/usr/local/m2/libs/Storage.def:
/usr/local/m2/libs/Storage.def:   Title      : Storage

(16)  PROCEDURE myproc (VAR i: CARDINAL) ;
      BEGIN
         FOR i := 0 TO 10 DO
         END
      END myproc ;

      the for loop index would be garbage because of the VAR
      parameter.
      This is now fixed.

(17)  using SIZE(variable) in an expression resulted in temp temporary
      variables having a wrong type. This sometimes resulted in type
      incompatability during optimization.
      This is now fixed.

(18)  m2/os/rtp/ass4 fails if the microkernel is built with -Oi586
      (it works fine if -Odynamic is used without -Oi586 though).
      This is a high priority bug..
