From: roth@srzts204 (G.Roth, 2958,H267)
Subject: Bugs in Terra's M2-Compiler V4.1-2 for VMS
News-Software: VAX/VMS VNEWS 1.41    
Organization: Alcatel STR AG Switzerland
Date: Wed, 26 Aug 1992 16:27:00 GMT

A recent message asked about bugs in the Terra-Datentechnik (former Logitech)
Modula-2 compiler.
Hereafter the list of bugs we currently know:

===============================================================================

MODULE bug1;

PROCEDURE P( a,b : INTEGER );
END P;

BEGIN
  P( 1, 2, );
END bug1.


Comment:
	A comma after the last valid parameter crashes the compiler.

$ modula/log=(all,noquali) bug1.mod
TERRA Datentechnik MODULA-2/VMS V4.1-2, October 89
(C) LOGITECH 1985 - 1989, TERRA 1989
Compiling STR_BK_TAV:[TAV.B_RUESS]BUG1.MOD;1
Syntax analysis
Declaration analysis
Body analysis
Code generation
%M2VMS-F-ASSFAIL, compiler error (assertion failed)


===============================================================================

DEFINITION MODULE bug2_1;

EXPORT QUALIFIED
  Opaq;

TYPE
  Opaq;

END bug2_1.


MODULE bug2;

FROM bug2_1 IMPORT 
  Opaq;

VAR
 q1,q2 : Opaq;

BEGIN
  IF q1=q2 THEN END;
END bug2.


Comment:

	According to N.Wirth "Programming in Modula-2" the operations :=, =
	and # are defined and admissable for opaque types. But the compiler
	is giving an error message:

$ modula/log=(all,noquali) bug2_1.def
TERRA Datentechnik MODULA-2/VMS V4.1-2, October 89
(C) LOGITECH 1985 - 1989, TERRA 1989
Compiling STR_BK_TAV:[TAV.B_RUESS]BUG2_1.DEF;2
Syntax analysis
Declaration analysis
Symbol file generation
End of compilation
$
$ modula/log=(all,noquali) bug2.mod
TERRA Datentechnik MODULA-2/VMS V4.1-2, October 89
(C) LOGITECH 1985 - 1989, TERRA 1989
Compiling STR_BK_TAV:[TAV.B_RUESS]BUG2.MOD;2
Syntax analysis
 bug2_1: STR_BK_TAV:[TAV.B_RUESS]BUG2_1.SYM;1
Declaration analysis
Body analysis
 ---- error
Error messages
   10	  IF q1=q2 THEN END;
%M2VMS,          ^ operation with incompatible type
End of compilation
%M2VMS-F-ENDERR, Modula completed with ERRORS detected


===============================================================================

MODULE bug3;

FROM SYSTEM IMPORT
  QUADWORD;

PROCEDURE P( s : QUADWORD );
END P;

PROCEDURE Q( a : ARRAY OF CHAR );
BEGIN
  P( a );
END Q;

END bug3.


Comment:

	This program gets compiled WITHOUT error message though there is a
	type conflict at the call of P (the actual parameter is of type
	ARRAY OF CHAR while the formal type is of type QUADWORD)

$ modula/log=(all,noquali) bug3.mod
TERRA Datentechnik MODULA-2/VMS V4.1-2, October 89
(C) LOGITECH 1985 - 1989, TERRA 1989
Compiling STR_BK_TAV:[TAV.B_RUESS]BUG3.MOD;1
Syntax analysis
Declaration analysis
Body analysis
Code generation
End of compilation


===============================================================================

MODULE bug4;

TYPE
  Enum=(en1,en2,en3,en4,en5);

VAR
  e : Enum;

BEGIN
  e := MIN(Enum);
  e := MAX(Enum);
END bug4.


Comment:

	The compiler sees MIN(Enum) and MAX(Enum) as incompatible to e.

$ modula/log=(all,noquali) bug4.mod
TERRA Datentechnik MODULA-2/VMS V4.1-2, October 89
(C) LOGITECH 1985 - 1989, TERRA 1989
Compiling STR_BK_TAV:[TAV.B_RUESS]BUG4.MOD;1
Syntax analysis
Declaration analysis
Body analysis
 ---- error
Error messages
   10	  e := MIN(Enum);
%M2VMS,   ^ type incompatibility
   11	  e := MAX(Enum);
%M2VMS,   ^ type incompatibility
End of compilation
%M2VMS-F-ENDERR, Modula completed with ERRORS detected

===============================================================================

MODULE bug5;

FROM SYSTEM IMPORT
  SIZE;

FROM InOut IMPORT
  WriteString, WriteInt, WriteLn;

VAR
  a : ARRAY [0..3] OF CHAR;
  b : ARRAY [0..4] OF CHAR;
  c : RECORD x:ARRAY [0..3] OF CHAR; END;
  d : RECORD x:ARRAY [0..4] OF CHAR; END;
  e : RECORD x:CHAR; END;
  f : RECORD x,y:CHAR; END;
  g : RECORD x,y,z:CHAR; END;

BEGIN
  WriteString( "  SIZE(a)   (* =4 *)" ); WriteInt( SIZE(a),   3 ); WriteLn;
  WriteString( "  SIZE(b)   (* =5 *)" ); WriteInt( SIZE(b),   3 ); WriteLn;
  WriteLn;
  WriteString( "  SIZE(c)   (* =4 *)" ); WriteInt( SIZE(c),   3 ); WriteLn;
  WriteString( "  SIZE(c.x) (* =4 *)" ); WriteInt( SIZE(c.x), 3 ); WriteLn;
  WriteString( "  SIZE(d)   (* =5 *)" ); WriteInt( SIZE(d),   3 ); WriteLn;
  WriteString( "  SIZE(d.x) (* =5 *)" ); WriteInt( SIZE(d.x), 3 ); WriteLn;
  WriteLn;
  WriteString( "  SIZE(e)   (* =1 *)" ); WriteInt( SIZE(e),   3 ); WriteLn;
  WriteString( "  SIZE(e.x) (* =1 *)" ); WriteInt( SIZE(e.x), 3 ); WriteLn;
  WriteString( "  SIZE(f)   (* =2 *)" ); WriteInt( SIZE(f),   3 ); WriteLn;
  WriteString( "  SIZE(f.x) (* =1 *)" ); WriteInt( SIZE(f.x), 3 ); WriteLn;
  WriteString( "  SIZE(g)   (* =3 *)" ); WriteInt( SIZE(g),   3 ); WriteLn;
  WriteString( "  SIZE(g.x) (* =1 *)" ); WriteInt( SIZE(g.x), 3 ); WriteLn;
END bug5.


Comment:
	SIZE() of a record type whose true length is odd and larger than 1
	returns a value that is 1 too large:

$ modula/nolog bug5.mod
$ link bug5
$ run bug5
  SIZE(a)   (* =4 *)  4
  SIZE(b)   (* =5 *)  5

  SIZE(c)   (* =4 *)  4
  SIZE(c.x) (* =4 *)  4
  SIZE(d)   (* =5 *)  6
  SIZE(d.x) (* =5 *)  5

  SIZE(e)   (* =1 *)  1
  SIZE(e.x) (* =1 *)  1
  SIZE(f)   (* =2 *)  2
  SIZE(f.x) (* =1 *)  1
  SIZE(g)   (* =3 *)  4
  SIZE(g.x) (* =1 *)  1

===============================================================================

MODULE bug6;

FROM bug6_1 IMPORT 
  xyz;

BEGIN
END bug6.


Comment:
	If the definition file is not yet compiled, the compiler exactly
	states this fact; In the diagnostic file (used for LSE) however,
	there is a incomprehensible message which does not tell the true fault.

$ modula/log=(all,noquali)/diag bug6.mod
TERRA Datentechnik MODULA-2/VMS V4.1-2, October 89
(C) LOGITECH 1985 - 1989, TERRA 1989
Compiling STR_BK_TAV:[TAV.B_RUESS]BUG6.MOD;1
Syntax analysis
 bug6_1:   ---- no file found
 ---- error
%M2VMS-E-MISSYM, symbol files missing
End of compilation
%M2VMS-F-ENDERR, Modula completed with ERRORS detected
$
$ type bug6.dia

START MODULE
!
START DIAGNOSTIC
REGION/FILE/PRIMARY/LINE=6/COLUMN=(5)  STR_BK_TAV:[TAV.B_RUESS]BUG6.MOD;1
MESSAGE/TEXT=QUOTED "%M2VMS-E-POINTEXP, '.' expected"
END DIAGNOSTIC
!
START DIAGNOSTIC
REGION/FILE/PRIMARY/LINE=1/COLUMN=(1)  STR_BK_TAV:[TAV.B_RUESS]BUG6.MOD;1
MESSAGE/TEXT=QUOTED "%NONAME-E-NOMSG, Message number 480D9652"
END DIAGNOSTIC
!
END MODULE

===============================================================================

DEFINITION MODULE bug7_1;

EXPORT QUALIFIED
  aaa,
  xyz;

TYPE
  aaa;

END bug7_1.


Comment:
	If not all exported identifiers are declared in the definition
	module, the diagnostic file does not contain information about
	the missing identifier.

$ modula/log=(all,noquali)/diag bug7_1.def
TERRA Datentechnik MODULA-2/VMS V4.1-2, October 89
(C) LOGITECH 1985 - 1989, TERRA 1989
Compiling STR_BK_TAV:[TAV.B_RUESS]BUG7_1.DEF;1
Syntax analysis
Declaration analysis
 ---- error
Error messages
   10	END bug7_1.
%M2VMS,   ^ undeclared identifier in export-list of the module \xyz\
End of compilation
%M2VMS-F-ENDERR, Modula completed with ERRORS detected
$
$ type bug7_1.dia

START MODULE
!
START DIAGNOSTIC
REGION/FILE/PRIMARY/LINE=10/COLUMN=(3)  STR_BK_TAV:[TAV.B_RUESS]BUG7_1.DEF;1
MESSAGE/TEXT=QUOTED "%M2VMS-E-UNDECID, undeclared identifier in export-list of the module"
END DIAGNOSTIC
!
END MODULE


Guido Roth (3.941)   | Tel: +41-1-465 2958                 Fax: +41-1-465 3525 |
Alcatel STR AG       | INTERNET: guido.roth@alcatel.ch                         |
Friesenbergstr. 75   | X.25:     PSI%4795123920::ROTH                          |
CH 8055 Zurich       | X.400:    C=ch ADMD=arcom PRMD=alcatel S=roth G=guido   |
Newsgroups: comp.lang.modula2