# Compiler messages

This chapter gives explanation for compiler diagnostics. For each error, an error number is provided along with a text of error message and an explanation. An error message can contain a format specifier in the form `%d` for a number or `%s` for a string. In this case, an argument (or arguments) is described on the next line.

In most cases the compiler prints a source line in which the error was found. The position of the error in the line is marked with a dollar sign placed directly before the point at which the error occurred.

- Lexical errors
- Syntax errors
- Semantic errors
- Symbol files read/write errors
- Internal errors
- Warnings
- Pragma warnings
- Native XDS warnings
- XDS-C errors

## Lexical errors

- E001
- E002
- E003
- E004
- F005
- E006
- F010
- E012
- E171
- E172
- F173
- F174
- E175

### E001

`illegal character`

All characters within the Modula-2 or Oberon-2 character sets are acceptable. Control characters in the range `0C` to `37C` are ignored. All other characters, e.g. `%` are invalid.

### E002

`comment not closed; started at line %d` (line number)

This error is reported if a closing comment bracket is omitted for a comment started at the given line.

### E003

`illegal number`

This error is reported in the following cases:

- a numeric constant contains a character other than a digit (`0..7` for octal constants, `0..9` for decimal, `0..9,A..F` for hexadecimal).
- an exponent indicator is not followed by an integer
- an illegal suffix is used after a number, e.g. `"X"` in Modula-2 or `"C"` or `"B"` in Oberon-2.

### E004

`string literal not closed or too long`

This error usually occurs if a closing quote is omitted or does not match the opening quote. Note that a string literal is limited to a single line and its size cannot exceed 256 characters. In Modula-2, string concatenation may be used to build long literal strings.

### F005

`unexpected end of file`

Input file ends before end of a module.

### E006

`identifier too long`

Length of an identifier exceeds compiler limit (127 characters).

### F010

`source text read error`

A read error occurs while reading source text.

### E012

`character constant too large (377C or 0FFX is maximum)`

The meaning of this message is obvious.

### E171

`illegal structure of conditional compilation options`

This error is reported if a structure of conditional `IF` statements is broken, e.g. there is no `IF` for an `END`, `ELSE`, or `ELSIF` clause or there is no `END` for an `IF`.

### E172

`conditional compilation option starts with incorrect symbol`

`IF`, `ELSIF`, `ELSE`, `END` or identifier expected.

### F173

`pragma not closed; started at line %d` (line number)

This error is reported if a closing bracket `"*>"` is omitted for a pragma started at the given line.

### F174

`unexpected end of file while skipping; see at %d` (line number)

Input file ended while the compiler was skipping source text according to the conditional compilation statement. It may be a result of a missed `<* END *>` clause. Check the pragma at the given line.

### E175

`invalid pragma syntax`

Check the manual for the pragma syntax.

## Syntax errors

- E007
- E008
- E081
- E082
- E083
- E085
- E086

### E007

`identifier expected`

The compiler expects an identifier at the indicated position.

### E008

`expected symbol %s` (symbol)

The compiler expects the given symbol at the indicated position. The symbol may be one of the following:

         |       ;       :       .       [       ]       :=
         (       )       {       }       ,       =       ..
         DO      END     OF      THEN    TO      UNTIL   IMPORT
         MODULE

### E081

`expected start of factor`

The compiler expects start of factor at the indicated position, i.e. an identifier, literal value, aggregate, left parenthesis, etc. See the syntax of the language for more information.

### E082

`expected start of declaration`

The compiler expects start of declaration at the indicated position, i.e. one of the keywords: `"CONST"`, `"VAR"`, `"TYPE"`, `"PROCEDURE"`, `"BEGIN"`, or `"END"`.

### E083

`expected start of type`

The compiler expects start of a type at the indicated position. See the syntax of the language for more information.

### E085

`expected expression`

The compiler expects expression at the indicated position.

### E086

`expected start of statement`

The compiler expects start of a statement at the indicated position. See the syntax of the language for more information.

## Semantic errors

- E020
- E021
- E022
- E028
- E023
- E024
- E025
- E026
- E027
- E029
- E030
- E031
- E032
- E033
- E034
- E035
- E036
- E037
- E038
- E039
- E040
- E041
- E043
- E044
- E046
- E047
- E048
- E049
- E050
- E051
- E052
- E053
- E054
- E055
- E057
- E058
- E059
- E060
- E061
- E062
- E064
- E065
- E067
- E068
- E069
- E071
- E072
- E074
- E075
- E076
- E078
- E087
- E088
- E089
- E090
- E091
- E092
- E093
- E094
- E095
- E096
- E097
- E098
- E099
- E100
- E102
- E107
- E109
- E110
- E111
- E112
- E113
- E114
- E116
- E118
- E119
- E120
- E121
- E122
- E123
- E124
- E125
- E126
- E128
- E129
- E131
- E132
- E133
- E134
- E135
- E136
- E137
- E139
- E140
- E141
- E143
- E144
- E145
- E146
- E147
- E148
- E149
- E150
- E151
- E152
- E153
- E154
- E155
- E156
- E158
- E159
- E160
- E161
- E162
- E163
- E200
- E201
- E202
- E203
- E206
- E208
- E219
- E220
- E221
- E281
- E282
- E283

### E020

`undeclared identifier "%s"` (name)

The given identifier has no definition in the current scope.

### E021

`type identifier "%s" shall not be used in declaring itself` (name)

An identifier being declared as a type shall not be used in declaring that type, unless that type is a new pointer type or a new procedure type. This error will be reported for the following example

        TYPE
          Rec = RECORD
            next: POINTER TO Rec;
          END;

use the following declarations instead:

        TYPE
          Ptr = POINTER TO Rec;
          Rec = RECORD
            next: Ptr;
          END;

### E022

`identifier "%s" was already defined at %s[%d.%d]` (name,file name,line,column)

### E028

`identifier "%s" was already defined in other module` (name)

An identifier being declared is already known in the current context (the name used has some other meaning). If a file name and text position of previous definition are known, the compiler reports error 022 otherwise 028.

### E023

`procedure with forward declaration cannot be a code procedure`

A forward declaration of a procedure is followed by a declaration of a code procedure.

### E024

`recursive import not allowed`

A module imports itself. Example:

        MODULE xyz;

        IMPORT xyz;

        END xyz.

### E025

`unsatisfied exported object`

An object exported from a local object is not defined there. Example:

        MODULE M; (* local module *)

        EXPORT Foo;

        END M;

### E026

`identifier "%s" is used in its own declaration, see %s[%d.%d]`

An identfier cannot be used in its own declaration, like in:

        CONST c = 1;
        PROCEDURE proc;
          CONST c = c + 1;
        END proc;

### E027

`illegal usage of module identifier "%s"` (module name)

An identifier denoting module cannot be used at the indicated position.

### E029

`incompatible types: "%s" "%s"`(type,type)

### E030

`incompatible types`

The compiler reports this error in the following cases:

- operands in an expression are not expression compatible
- an expression is not compatible with the type of the variable in an assignment statement
- an actual parameter is not compatible with the type of the formal parameter in a procedure call

The compiler reports error 29 if it can display incompatible types and error 30 otherwise.

### E031

`identifier does not denote a type`

An identifier denoting a type is expected at the indicated position.

### E032

`scalar type expected`

The compiler expects a scalar type (real, integer, cardinal, range, enumeration, `CHAR`, or `BOOLEAN`).

### E033

`ordinal type expected`

The compiler expects a value, variable, or type designator of ordinal type, i.e. `CHAR`, `BOOLEAN`, enumeration, integer, or cardinal type or a subrange of one of those types.

### E034

`invalid combination of parameters in type conversion`

According to the language definition this combination of parameters in a call of the standard procedure `VAL` is not valid.

### E035

`NEW: "%s" not known in this scope` (ALLOCATE or DYNALLOCATE)

A call to `NEW` is treated as a call to `ALLOCATE` (or `DYNALLOCATE` for open arrays). The required procedure is not visible in this scope. It must be either imported or implemented.

Note: In XDS, the default memory managemet routines may be enabled by setting the STORAGE option ON.

### E036

`DISPOSE: "%s" not known in this scope` (DEALLOCATE or DYNDEALLOCATE)

A call to `DISPOSE` is treated as a call to `DEALLOCATE` (or `DYNDEALLOCATE` for open arrays). The required procedure is not visible in this scope. It must be either imported or implemented.

Note: In xds, the default memory managemet routines may be enabled by setting the STORAGE option ON.

### E037

`procedure "%s" should be a proper procedure` (procedure name)

In Modula-2, calls of `NEW` and `DISPOSE` are substituted by calls of `ALLOCATE` and `DEALLOCATE` (for dynamic arrays by calls of `DYNALLOCATE` and `DYNDEALLOCATE`). The error is reported if one of those procedures is declared as a function.

### E038

`illegal number of parameters "%s"` (procedure name)

In Modula-2, calls of `NEW` and `DISPOSE` are substituted by calls of `ALLOCATE` and `DEALLOCATE` (for dynamic arrays by calls of `DYNALLOCATE` and `DYNDEALLOCATE`). The error is reported if a number of parameters in the declaration of a substitution procedure is wrong.

### E039

`procedure "%s": %s parameter expected for "%s"` (procedure name,"VAR" or "value",parameter name)

In Modula-2, calls of `NEW` and `DISPOSE` are substituted by calls of `ALLOCATE` and `DEALLOCATE` (for dynamic arrays by calls of `DYNALLOCATE` and `DYNDEALLOCATE`). The error is reported if the kind (variable or value) of the given parameter in the declaration of a substitution procedure is wrong.

### E040

`procedure "%s": type of parameter "%s" mismatch`

In Modula-2, calls of `NEW` and `DISPOSE` are substituted by calls of `ALLOCATE` and `DEALLOCATE` (for dynamic arrays by calls of `DYNALLOCATE` and `DYNDEALLOCATE`). The error is reported if a type of the given parameter in the declaration of a substitution procedure is wrong.

### E041

`guard or test type is not an extension of variable type`

In an Oberon-2 type test (`v IS T`) or type quard (`v(T)`), `T` should be an extension of the static type of `v`.

### E043

`illegal result type of procedure`

A type cannot be a result type of a function procedure (language or implementation restriction).

### E044

`incompatible result types`

A result type of a procedure does not match those of a forward definition or definition of an overriden method.

### E046

`illegal usage of open array type`

Open arrays (`ARRAY OF`) usage is restricted to pointer base types, element types of open array types, and formal parameter types.

### E047

`fewer actual than formal parameters`

The number of actual parameters in a procedure call is less than the number of formal parameters.

### E048

`more actual than formal parameters`

The number of actual parameters in a procedure call is greater than the number of formal parameters.

### E049

`sequence parameter should be of SYSTEM.BYTE or SYSTEM.LOC type`

The only valid types of a sequence parameter are `SYSTEM.BYTE` and `SYSTEM.LOC`.

### E050

`object is not array`

### E051

`object is not record`

### E052

`object is not pointer`

### E053

`object is not set`

The compiler expects an object of the given type at the indicated position.

### E054

`object is not variable`

The compiler expects a variable (designator) at the indicated position.

### E055

`object is not procedure: %s` (procedure name)

The compiler expects a procedure designator at the indicated position.

### E057

`a call of super method is valid in method redifinition only`

A call of a super method (type-bound procedure bound to a base type) is valid only in a redifinition of that method:

        PROCEDURE (p: P) Foo;
        BEGIN
          p.Foo^
        END Foo.

### E058

`type-bound procedure is not defined for the base type`

In a call of a super method (type-bound procedure bound to a base type) `p.Foo^` either `Foo` is not defined for a base type of `p` or there is no base type.

### E059

`object is neither a pointer nor a VAR-parameter record`

The Oberon-2 compiler reports this error in the following cases:

- in a type test `v IS T` or type guard `v(T)`, `v` should be a designator denoting either pointer or variable parameter of a record type; `T` should be a record or pointer type
- in a declaration of type-bound procedure a receiver may be either a variable parameter of a record type or a value parameter of a pointer type.

### E060

`pointer not bound to record or array type`

In Oberon-2, a pointer base type must be an array or record type. For instance, the declaration `TYPE P = POINTER TO INTEGER` is invalid.

### E061

`dimension too large or negative`

The second parameter of the LEN function is either negative or larger than the maximum dimension of the given array.

### E062

`pointer not bound to record`

The Oberon-2 compiler reports this error in the following cases:

- in a type test `v IS T` or type guard `v(T)`, if `v` is a pointer it should be a pointer to record
- in a type-bound procedure declaration, if a receiver is a pointer, it should be a pointer to record

### E064

`base type of open array aggregate should be a simple type`

A base type of an open array aggregate (`ARRAY OF T{}`) cannot be a record or array type.

### E065

`the record type is from another module`

A procedure bound to a record type should be declared in the same module as the record type.

### E067

`receiver type should be exported %s` (name of type)

A receiver type for an exported type-bound procedure should also be exported.

### E068

`this type-bound procedure cannot be called from a record`

The receiver parameter of this type-bound procedure is of a pointer type, hence it cannot be called from a designator of a record type. Note that if a receiver parameter is of a record type, such type-bound procedure can be called from a designator of a pointer type as well.

### E069

`wrong mode of receiver type`

A mode of receiver type in a type-bound procedure redefinition does not match the previous definition.

### E071

`non-Oberon type cannot be used in specific Oberon-2 construct`

A (object of) non-Oberon type (imported from a non-Oberon module or declared with direct language specification) cannot be used in specific Oberon-2 constructs (type-bound procedures, type guards, etc).

### E072

`illegal order of redefinition of type-bound procedures`

A type-bound procedure for an extended type is defined before a type-bound procedure with the same name for a base type.

### E074

`redefined type-bound procedure should be exported`

A redefined type-bound procedure should be exported if both its receiver type and redefining procedure are exported.

### E075

`function procedure without RETURN statement`

A function procedure has no `RETURN` statement and so cannot return a result.

### E076

`value is required`

The compiler expects an expression at the indicated position.

### E078

`SIZE (TSIZE) cannot be applied to an open array`

Standard functions `SIZE` and `TSIZE` cannot be used to evaluate size of an open array designator or type in the standard mode. If language extensions are enabled, the compiler allows to apply `SIZE` to an open array designator, but not type.

### E087

`expression should be constant`

The compiler cannot evaluate this expression at compile time. It should be constant according to the language definition.

### E088

`identifier does not match block name`

An identifier at the end of a procedure or module does not match the one in the procedure or module header. The error may occur as a result of incorrect pairing of `END`s with headers.

### E089

`procedure not implemented "%s"`

An exported procedure or forward procedure is not declared. This error often occurs due to comment misplacement.

### E090

`proper procedure is expected`

A function is called as a proper procedure. It must be called in an expression. A function result can be ignored for procedures defined as `"C"`, `"Pascal"`, `"StdCall"` or `"SysCall"` only. See Direct language specification.

### E091

`call of proper procedure in expression`

A proper procedure is called in an expression.

### E092

`code procedure is not allowed in definition module`

### E093

`not allowed in definition module`

The error is reported for a language feature that can not be used in definition module, including:

- local modules
- elaboration of an opaque type
- forward declaration
- procedure or module body
- read-only parameters

### E094

`allowed only in definition module`

The error is reported for a language feature that can be used in definition module only, i.e. read-only variables and record fields (extended Modula-2).

### E095

`allowed only in global scope`

The error is reported for a language feature that can be used only in the global module scope, including:

- elaboration of an opaque type (Modula-2)
- export marks (Oberon-2)
- type-bound procedure definition (Oberon-2)

### E096

`unsatisfied opaque type "%s"`

An opaque type declared in a definition module must be elaborated in the implementation module.

### E097

`unsatisfied forward type "%s"`

A type `T` can be introduced in a declaration of a pointer type as in:

`TYPE Foo = POINTER TO T;`

This type `T` must then be declared at the same scope.

### E098

`allowed only for value parameter`

The error is reported for a language feature that can be applied to value parameter only (not to `VAR` parameters), such as a read-only parameter mark.

### E099

`RETURN allowed only in procedure body`

In Oberon-2, the `RETURN` statement is not allowed in a module body.

### E100

`illegal order of declarations`

In Oberon-2. all constants, types and variables in one declaration sequence must be declared before any procedure declaration.

### E102

`language extension is not allowed %s` (specification)

The error is reported for a language feature that can be used only if language extensions are switched on. See options M2EXTENSIONS and O2EXTENSIONS.

### E107

`shall not have a value less than 0`

The error reported if a value of a (constant) expression cannot be negative, including:

- second operand of `DIV` and `MOD`
- repetition count in an array constructor (`expr BY count`)

### E109

`forward type cannot be opaque`

A forward type `T` (declared as `TYPE Foo = POINTER TO T`) cannot be elaborated as an opaque type, i.e. declared as `TYPE T = <opaque type>`).

### E110

`illegal length, %d was expected` (expected number of elements)

Wrong number of elements in an array constructor.

### E111

`repetition counter must be an expression of a whole number type`

A repetition counter in an array constructor must be of a whole number type.

### E112

`expression for field "%s" was expected` (field name)

The error is reported if a record constructor does not contain an expression for the given field.

### E113

`no variant is associated with the value of the expression`

The error is reported if a record constructor for a record type with variant part does not have a variant for the given value of a record tag and the `ELSE` clause is omitted.

### E114

`cannot declare type-bound procedure: "%s" is declared as a field`

A type-bound procedure has the same name as a field already declared in that type or one of its base types.

### E116

`field "%s" is not exported` (field name)

The given field is not exported, put export mark into the declaration of the record type.

### E118

`base type is not allowed for non-Oberon record`

A record type can be defined as an extension of another type, only if it is an Oberon-2 record type.

### E119

`variant fields are not allowed in Oberon record`

A record with variant parts cannot be declared as an Oberon-2 record.

### E120

`field of Oberon type is not allowed in non-Oberon record`

This is considered an error because garbage collector does not trace non-Oberon records and reference to an object may be lost.

### E121

`illegal use of type designator "%s"`

A type designator cannot be used in a statement position.

### E122

`expression out of bounds`

A value which can be checked at compile-time is out of range.

### E123

`designator is read-only`

A designator marked as read-only cannot be used in a position where its value may be changed.

### E124

`low bound greater than high bound`

A lower bound of a range is greater than high bound.

### E125

`EXIT not within LOOP statement`

An `EXIT` statement specifies termination of the enclosing `LOOP` statement. This `EXIT` is not within any `LOOP`.

### E126

`case label defined more then once`

In a `CASE` statement all labels must have different values. The label at the indicated position is alfeady used in this `CASE` statement.

### E128

`FOR-loop control variable must be declared in the local scope`

A control variable of a `FOR` loop must be declared locally in the procedure or module which body contains the loop.

### E129

`more expressions than fields in a record type`

In a record constructor there are more expressions than there are fields in the record type (or in this variant of a variant record type).

### E131

`zero step in FOR statement`

In a `FOR` statement, the step cannot be equal to zero.

### E132

`shall be an open array designator`

If language extensions are OFF, the standard procedure `HIGH` can be applied to open arrays only, otherwise to any array designator.

### E133

`implementation limit exceeded for set base type (length > %d)`

The compiler restricts length of a base type of set (`MAX(base)-MIN(base)+1`). Note, that the limit does not depend on the low bound, so the following set types are valid:

`SET OF [-256..-5]`
`SET OF [MAX(INTEGER)-512..MAX(INTEGER)]`

### E134

`must be value of unsigned type`

The compiler expects a parameter of this standard procedure to be a value of an unsigned type.

### E135

`must be value of pointer type`

The compiler expects a parameter of this standard procedure to be a value of a pointer type. Note: the `SYSTEM.ADDRESS` type is defined as `POINTER TO LOC`.

### E136

`must be type designator`

The compiler expects a parameter of this standard procedure to be a type designator.

### E137

`numeric constant does not have a defined storage size`

The compiler must know the size of a value in the given context. A numeric constant cannot be used at the indicated position.

### E139

`must be (qualified) identifier which denotes variable`

The ISO standard requires an "entire designator" in this context, e.g. as a parameter of the `SIZE` function. It may be either a variable (which may be a formal parameter) or a field of a record variable within a `WITH` statement that applies to that variable.

### E140

`interrupt procedures are not implemented yet`

Oberon compilers from ETH implements so-called interrupt procedures, marked by the symbol "+".

`PROCEDURE + Foo;`

In XDS, this feature is not implemented.

### E141

`opaque type can not be defined as Oberon pointer`

A Modula-2 opaque type cannot be elaborated as an Oberon-2 pointer. See Chapter Multilanguage programming.

### E143

`not allowed in Oberon`

The compiler reports this error for language features that are vaild in Modula-2 but not in Oberon-2, including:

- enumeration types
- range types
- local modules

### E144

`pointer and record types are mixed in type test`

In an Oberon-2 type test `v IS T` or a type guard `v(T)`, both `v` and `T` must be either pointers or records.

### E145

`control variable must not be a formal parameter`

According to ISO Modula-2, a control variable in a `FOR` statement cannot be a formal parameter (either `VAR` or value).

### E146

`control variable cannot be exported`

A variable used as a control variable in a `FOR` statement or an Oberon-2 `WITH` statement cannot be exported.

### E147

`control variable cannot be threatened`

A control variable of a `FOR` statement or an Oberon-2 `WITH` statement has been threatened inside the body of the statement, or in a nested procedure called from the body. Threatening actions include assignment and passing as a `VAR` parameter to a user-defined or standard procedure (`ADR`, `INC`, `DEC`, etc). The compiler also reports the error 158 to indicate the exact place of threatening.

### E148

`finalization is allowed only in module block`

A procedure body can not contain a finalization part.

### E149

`RETRY is allowed only in exceptional part of block`

This `RETRY` statement is outside an exceptional part of a block.

### E150

`wrong value of direct language specification`

A value must be either one of the strings (`"Modula"`, `"Oberon"`, `"C"`,`"Pascal"`, `"SysCall"`, or `"StdCall"`) or the corresponding integer value. We recommend to use strings, integer values are preserved for backward compatibility.

### E151

`must be of integer type`

The compiler expects a variable of an integer type.

### E152

`incompatible calling conventions: "%s" "%s"`

### E153

`incompatible calling conventions`

Two procedure types have different calling conventions. The error can reported in the following cases:

- a procedure is assigned to a procedure variable
- a procedure is passed as a parameter
- two procedure values are compared

The compiler reports error 152 if it can show incompatible types and error 153 otherwise.

### E154

`procedure "%s" does not match previous definition: was: %s now: %s` (procedure name,proctype,proctype)

### E155

`procedure "%s" does not match previous definition` (procedure name)

A procedure heading must have the same number of parameters, the same parameter modes (variable or value) and the same types as in the previous declaration. A previous declaration may be one of the following:

- procedure declaration in a definition module
- forward procedure declaration
- type-bound procedure declaration in a base type

The compiler reports error 154 if it can show incompatible types and error 155 otherwise.

### E156

`procedure designator is expected`

A designator which appears to be called (e.g. `Foo(...)`) does not denote a procedure.

### E158

`control variable "%s" is threatened here` (variable name)

A control variable of a `FOR` statement or an Oberon-2`WITH` statement is threatened at the indicated position. It means that its value may be changed. See also error 147.

### E159

`type of aggregate is not set or array or record`

An object which appears to be an aggregate (e.g. `Foo{...}`) begins with an identifier which is not a set, record, or array type.

### E160

`invalid parameter specification: expected NIL`

Only one special kind of variable parameter is implemented: `VAR [NIL]`. It means that `NIL` may be passed to this parameter.

### E161

`VAR [NIL] parameter expected`

A parameter of the `SYSTEM.VALID` function must be a `VAR [NIL]` parameter.

### E162

`%s value should be in %{} (not "%s")` (equation,set of valid values,new value)

This error is reported for a wrong setting of `ALIGNMENT`, `ENUMSIZE`, or `SETSIZE` equation.

### E163

`control variable cannot not be volatile`

A control variable of a `FOR` statement cannot be marked as volatile. See the ??? option.

### E200

`not yet implemented`

This language feature is not implemented yet.

### E201

`real overflow or underflow in constant expression`

This error is to be reported if a real overflow (underflow) occurs during evaluation of a constant expression.

### E202

`integer overflow in constant expression`

The compiler uses 64-bits (signed) arithmetics for whole numbers. The error is reported if an overflow occurs during evaluation of a constant expression. In the following example, an error will be reported for the assignment statement, while constant definition is valid.

        MODULE Test;

        CONST
          VeryBigConstant = MAX(CARDINAL)*2;            (* OK *)
          TooBigConstant = VeryBigConstant*VeryBigConstant;   (* OK *)

        END Test.

### E203

`division by zero`

The second operand of a `DIV`, `MOD`, `REM`, or `"/"` operator is zero.

### E206

`array length is too large or less then zero`

The array length is either negative or exceeds implementation limit.

### E208

`CASE statement always fails`

The error is reported if a case select expression can be evaluated at compile-time and there is no variant corresponding to its value, and the `ELSE` clause is omitted. If not constantly evaluated, this `CASE` statement would cause the `caseSelectException` exception at run-time.

### E219

`too many nested open array types (implementation limit %d)` (implementation limit)

The compiler (more precisely, run-time support) puts a limit on the number of nested open array types (or dimensions). Note, that there is no limit for arrays with specified length, because such arrays do not require special support in run-time system.

### E220

`heirarchy of record extensions too high (implementation limit %d)` (implementation limit)

The run-time system puts a limit on the level of record extensions. It is required for efficient implementaion of type tests and type guards.

### E221

`procedure declaration nesting limit (%d) has been exceeded` (implementation limit)

The compiler puts a limit on the number of procedures nested inside each other. When modules are nested inside procedures, only the level of procedure declarations is counted.

### E281

`type-bound procedure is not valid as procedure value`

A type-bound procedure cannot be assigned to a variable of procedure type.

### E282

`local procedure is not valid as procedure value "%s"` (procedure name)

A procedure local to another one cannot be assigned to a variable of procedure type.

### E283

`code (or external) procedure is not valid as procedure value`

A code procedure and external procedure cannot be assigned to a variable of procedure type.

## Symbol files read/write errors

- F190
- F191
- F192
- F193
- F194
- F195

### F190

`incorrect header in symbol file "%s"` (module name)

A symbol file for the given module is corrupted. Recompile it.

### F191

`incorrect version of symbol file "%s" (%d instead of %d)` (module name, symfile version, current version)

The given symbol file is generated by a different version of the compiler. Recompile the respecitve source or use compatible versions of the compiler and/or symbol file.

### F192

`key inconsistency of imported module "%s"` (module name)

The error occurs if an interface of some module is changed but not all its clients (modules that imports from it) were recompiled. For example, let `A` imports from `B` and `M`; `B` in turn imports from `M`:

    DEFINITION MODULE M;   DEFINITION MODULE B;     MODULE A;
                           IMPORT M;                IMPORT M,B;
    END M.                 END B.                   END A.

Let us recompile `M.def`, `B.def` and then `M.def` again. The error will be reported when compiling `A.mod`, because version keys of module `M` imported through `B` is not equal to the version key of `M` imported directly.

To fix the problem modules must be compiled in appropriate order. We recommend to use the XDS compiler make facility, i.e. to compile your program in the MAKE or PROJECT operation mode. If you always use the make facility this error will never be reported.

### F193

`generation of new symbol file not allowed`

The Oberon-2 compiler creates a temporary symbol file every time a module is compiled, compares that symbol file with the existing one and overwrites it with the new one if necessary. When the CHANGESYM option is OFF (by default), the compiler reports an error if the symbol file (and hence the module interface) had been changed and does not replace the old symbol file.

Note: if the M2CMPSYM option is set ON, the same applies to compilation of a Modula-2 definition module, i.e., the CHANGESYM option should be set if the module interface has been changed.

### F194

`module name does not match symbol file name "%s"` (module name)

A module name used in an `IMPORT` clause must be equal to the actual name of the module, written in the module heading.

### F195

`cannot read symbol file "%s" generated by %s` (module name, compiler name)

The symbol file for the given module is generated by another XDS compiler. Native code compilers can read symbol files generated by XDS-C on the same platform, but not vice versa.

## Internal errors

This section lists internal compiler errors. In some cases such a error may occur as a result of inadequate recovery from previous errors in your source text. In any case we recommend to provide us with a bug report, including:

- version of the compiler
- description of your environment (OS, CPU)
- minimal source text reproducing the error

- F103
- F104
- F105
- F106
- F142
- F196
- F197

### F103

`INTERNAL ERROR(ME): value expected`

### F104

`INTERNAL ERROR(ME): designator expected`

### F105

`INTERNAL ERROR(ME): statement expected`

### F106

`INTERNAL ERROR(ME): node type = NIL`

### F142

`INTERNAL ERROR(ME): can not generate code`

### F196

`INTERNAL ERROR: incorrect sym ident %d while reading symbol file "%s"`

### F197

`INTERNAL ASSERT(%d) while reading symbol file "%s"`

## Warnings

In many cases a warning may help you to find a bug or a serious drawback in your source text. We recommend not to switch warnings off and carefully check all of them. In many cases warnings have helped us to find and fix bugs very quickly (note that XDS compilers are written in XDS Oberon-2 and Modula-2).

Warnings described in this section are reported by both XDS-C and Native XDS. Each of these products may report additional warnings. Native XDS compilers fulfil more accurate analysis of the source code and report more warnings.

- W300
- W301
- W302
- W303
- W304
- W305
- W310
- W311
- W312
- W314
- W315
- W316
- W317
- W318

### W300

`variable declared but never used`

This variable is of no use, it is not exported, assigned, passed as a parameter, or used in an expression. The compiler will not allocate space for it.

### W301

`parameter is never used`

This parameter is not used in the procedure.

### W302

`value was assigned but never used`

The current version of the compiler does not report this warning.

### W303

`procedure declared but never used`

This procedure is not exported, called or assigned. The compiler will not generate it.

### W304

`possibly used before definition "%s"` (variable name)

This warning is reported if a value of the variable may be undefined at the indicated position. Note, that it is just a warning. The compiler may be mistaken in complex contexts. In the following example, `"y"` will be assigned at the first iteration, however, the compiler will report a warning, because it does not trace execution of the `FOR` statement.

        PROCEDURE Foo;
          VAR x,y: INTEGER;
        BEGIN
          FOR x:=0 TO 2 DO
            IF x = 0 THEN y:=1
            ELSE INC(y)  (* warning is reported here *)
            END;
          END;
        END Foo;

This warning is not reported for global variables.

### W305

`constant declared but never used`

The current version of the compiler does not report this warning.

### W310

`infinite loop`

Execution of this loop (`LOOP`, `WHILE` or `REPEAT`) will not terminate normally. It means that statements after the loop will never be executed and the compiler will not generate them. Check that the loop was intentionally made infinite.

### W311

`unreachable code`

This code cannot be executed and the compiler will not generate it (dead code elimination). It may be statements after a `RETURN`, `ASSERT(FALSE)`, `HALT`, infinite loop, statements under constant `FALSE` condition (`IF FALSE THEN`), etc.

### W312

`loop is executed exactly once`

It may be a loop like

`FOR i:=1 TO 1 DO ... END;`

or

`LOOP ...; EXIT END;`

Check that you wrote it intentionally.

### W314

`variable "%s" has compile time defined value here`

The compiler was able to determine the run-time value of the given variable (due to constant propagation) and will use it instead of accessing the variable. For the following example

`i:=5; IF i = 5 THEN S END;`

the compiler will generate:

`i:=5; S;`

This warning is not reported for global variables.

### W315

`NIL dereference`

The compiler knows that a value of a pointer variable is NIL (due to constant propagation), e.g:

`p:=NIL;`
`p^.field:=1;`

The code will be generated and will cause "invalidLocation" exception at run-time.

This warning is not reported for global variables.

### W316

`this SYSTEM procedure is not described in Modula-2 ISO standard`

This warning is reported in order to simplify porting your program to other Modula-2 compilers.

### W317

`VAR parameter is used here, check that it is not threatened inside WITH`

A variable parameter of a pointer type is used as a control variable in an Oberon-2 `WITH` statement. The compiler cannot check that it is not changed inside `WITH`. In the the following example `"ptr"` and, hence, `"p"` becomes `NIL` inside `WITH`:

        VAR ptr: P;

        PROCEDURE proc(VAR p: P);
        BEGIN
          WITH p: P1 DO
            ptr:=NIL;
            p.i:=1;
          END;
        END proc;

        BEGIN
          proc(ptr);
        END

We recommend to avoid using variable parameters of pointer types in `WITH` statements.

### W318

`redundant FOR statement`

The `FOR` statement is redundant (and not generated) if its low and high bounds can be evaluted at compile-time and it would be executed zero times, or if its body is empty.

## Pragma warnings

- W320
- W322
- W321
- W323
- W390

### W320

`undeclared option "%s"`

An undeclared option is used. Its value is assumed to be `FALSE`.

### W322

`undeclared equation "%s"`

An undeclared equation is used. Its value is undefined.

### W321

`option "%s" is already defined`

### W323

`equation "%s" is already defined`

The option (equation) is already defined, second declaration is ignored.

### W390

`obsolete pragma setting`

The syntax used is obsolete. The next release of the compiler will not understand it. We recommend to rewrite the clause using the new syntax.

## Native XDS warnings

- W900
- W901
- W902
- W903
- W910
- W911
- W912
- W913
- W914
- W915

### W900

`redundant code eliminated`

This warning is reported if a program fragment does not influence to the program execution, e.g:

`i:=1;`
`i:=2;`

The first assignemnt is redundant and will be deleted.

### W901

`redundant code not eliminated - can raise exception`

The same as W900, but the redundant code is preserved because it can raise an exception, e.g.:

`i:=a DIV b; (* raises exception if b <= 0 *)`
`i:=2;`

### W902

`constant condition eliminated`

The warning is reported if a boolean condition can be evaluated at run-time, e.g.

`IF (i=1) & (i=1) THEN (* the second condition is TRUE *)`

or

`j:=2;`
`IF (i=1) OR (j#2) THEN (* the second condition is FALSE *)`

### W903

`function result is not used`

The compiler ignores function result, like in:

`IF Foo() THEN END;`

### W910

`realValueException will be raised here`

### W911

`wholeValueException will be raised here`

### W912

`wholeDivException will be raised here`

### W913

`indexException will be raised here`

### W914

`rangeException will be raised here`

### W915

`invalidLocation exception will be raised here`

A warning from this group is reported if the compiler determines that the exception will be raised in the code corresponding to this program fragment. In this case the fragment is omitted and the compiler generates a call of a run-time procedure which will raise this exception.

## XDS-C errors

This section describes errors reported by the C code generator (back-end). The code generator is invoked only if no errors are found by the language parser.

- E1001
- E1002
- E1018
- E1003
- E1004
- E1005
- E1006
- E1007
- E1014
- E1015
- E1008
- E1009
- E1010
- E1011
- E1012
- E1013
- E1016
- E1017
- E1019

### E1001

`parameter "%s" is not declared` (parameter name)

An unknown parameter name is used in a protocol string of a code procedure.

### E1002

`can not generate recursive type definition`

### E1018

`can not generate recursive type declaration`

In C, a recursive type definition must contain a struct, while in Modula-2/Oberon-2 this is done via forward declaration of a pointer type. The following types cannot be generated in C:

`TYPE P = POINTER TO P;`

or

`TYPE P = POINTER TO A;`
`A = ARRAY [0..1] OF P;`

We feel that such types are of very low importance in real programs.

### E1003

`external names conflict: "%s.%s" and "%s.%s"`

The compiler forms an external name (name of exported object) in the form `<module name>_<object name>`. The error is reported if external names of two distinct objects are equal.

### E1004

`external name "%s.%s" conflict with standard name (xm.kwd)`

The same as previous error, an external name is equal to a name defined in the `xm.kwd` file.

### E1005

`unimplemented system procedure`

This standard (system) procedure is not implemented yet.

### E1006

`undefined array length for dimension %d`

The `LEN` function cannot be applied to an open array parameter of a procedure with the following calling conventions: `"C"`, `"SysCall"`, `"StdCall"`. In the case of a "normal" (Oberon-2/Modula-2) procedure the compiler passes an additional parameter for each dimension (length in this dimension). For `"C"`, `"SysCall"`, `"StdCall"` procedures only an address of an array is passed.

### E1007

`undefined array size for dimension %d`

The compiler cannot evaluate the array size.

### E1014

`can not get size of (%s)` (type)

The error is reported if the compiler cannot evaluate size of this type. See also the GENSIZE option.

### E1015

`too many parameters`

The implementation puts a limit on the number of parameters of a generated procedure (256). Note, that a source procedure may have less parameters, because additional parameters are passed for:

- open array parameters
- variable parameters of record type in Oberon-2
- functions returning compound types

### E1008

`can not generate expression`

### E1009

`can not generate l-value type cast`

### E1010

`can not generate type conversion`

### E1011

`can not generate aggregate`

### E1012

`can not generate statement`

### E1013

`cannot generate constant aggregate of this type`

### E1016

`can not generate type designator`

### E1017

`can not generate type declaration`

### E1019

`can not generate object declaration`

An error of this group usually means that some rare language feature (or combination) is not implemented yet. Please provide us with a bug report containing a miminal test case.