Echelon Neuron User Manual

Page 86

Advertising
background image

78

Neuron C Compiler Errors (NCC)

NCC#

Description

247

Statement deleted by optimizer [NCC#247]

The Neuron C compiler's optimizer deletes statements for a variety of

reasons. For example, the statement may represent unnecessary work, the
statement may represent dead (unreachable) code, or the optimizer has

combined the statement with another statement. This informatory

message is issued for two reasons. First, to let the programmer know why
a breakpoint cannot be set on what looks like an acceptable statement.

Second, to point out code that may never be executed due to erroneous
program logic. Consider the following examples:

<statements>
goto LABEL;
<statements>

//deleted by optimizer

LABEL:
<statements>

Since the goto statement causes a branch around code such that it can

never be executed, the compiler issues a "Statement deleted" message for
each statement. The last example demonstrates an error in program logic

discovered by the compiler. The next example demonstrates unnecessary

statements deleted by the optimizer:

int i;
switch (i) {
case 0:
<statements>
break;
case 1:
<statements>
break;
case 2:
<statements>
break; //

deleted

by

optimizer

}

In the above example, the last break statement in the switch statement is
unnecessary, since execution flow is the same with or without the break

statement. (However, it is recommended that the statement be coded as

shown anyway, because doing so will make future maintenance of the code
easier and less error-prone. It is good programming practice.)
The optimizer recognizes that any branch is unnecessary and eliminates

the unnecessary branch instruction. The informatory message is reported
to explain why a breakpoint cannot be set at what appears to be a valid

statement. No breakpoint can be set, since no code actually exists for this
statement. Note that informatory messages are not reported by the

compiler unless they are enabled by the #pragma fyi_on directive.

Advertising