Finding Undetected Errors [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation
HP Pascal/iX Reference Manual
Finding Undetected Errors
The following errors are currently undetected by the compiler at compile
time or by the system at run time. In any future release, an undetected
error may become a detected error.
Errors that are only detected when the ANSI option is ON, or when
STANDARD_LEVEL is set to ANSI, do not appear on this list.
There is no significance to the order in which errors are listed here.
1. Each component of a structured function result must be assigned a
value in the body of the function.
2. If assignment to a function result is conditional, it must occur
at run time.
3. A control variable in a FOR statement cannot be changed in the
statement after DO by calling a procedure or function with a
nonlocal reference to the variable.
4. A parameter of dispose cannot be an actual variable parameter, an
element of a record variable list of a WITH statement, or both.
Similarly, a dynamic variable in a region of the heap deallocated
by release cannot fall in one of these categories.
5. When the tag field of a record with variants is changed, all
previous variants become undefined.
6. For records with tagless variants, reference to a field for a
particular variant means that other previous variants become
undefined.
7. All possible record variants must be specified in a record
declaration.
8. When a value is established for the tag field of a record with
variants, it is illegal to use a field in another variant.
9. The compiler does not always detect uninitialized variables,
especially in these cases:
a. The path to use a variable cannot include the initializing
statement. Suppose:
PROCEDURE proc_a;
VAR
x,y : integer;
BEGIN
IF condition THEN x := 10 ELSE y := x;
.
.
.
END;
The assignment after ELSE does not cause a compile-time
error, even if x has not been initialized outside the IF
statement. (The compiler counts the assignment after THEN
as initialization.)
b. Not all the components of a record or array have been
assigned values. (The compiler counts the assignment to a
single component as initialization of the entire variable.)
c. An uninitialized global variable appears in a program
compiled with GLOBAL or EXTERNAL options, or in a program
that contains procedures or functions declared with the
EXTERNAL directive. (The compiler cannot check outside the
current source code.)
d. An uninitialized dynamic variable on the heap. (The
compiler cannot detect this at run time.)
e. Strwrite into an uninitialized string variable.
However, some of the above errors are detected when the compiler
option OPTIMIZE is ON.
10. An actual reference parameter cannot be an expression consisting
of a single variable in parentheses.
11. Case constant labels cannot be constant expressions.
12. Range checking code is suppressed when the type of logical file is
identical to the type of a variable to which a file component is
assigned. However, a physical file associated with the logical
file can have values out of range and the consequent errors are
undetected.
13. Applying put to an undefined file buffer variable.
14. The control variable of a FOR statement is undefined after the
execution of the FOR statement.
15. Dereferencing an undefined pointer is not always detected,
especially for pointers that have never been explicitly disposed.
16. Using a variable created with the long form of new as an actual
parameter.
17. Using a variable created with the long form of new in a assignment
statement.
18. Using a variable created with the long form of new in a factor
(for example, as an operand in an expression).
19. Altering the value of the record variable of a WITH statement
within the scope of the WITH statement.
20. Using put, dispose, or release to make an actual variable
parameter to a procedure undefined within the body of the
procedure.
MPE/iX 5.0 Documentation