 |
|
 |
MESC TOOL NEWS:
MESCT-NC77WA-981016D
NC77, NC77WA NC79, NC79WA Precautions
|
Please take note of the following problems in using C compilers NC77WA and NC77 for the 77XX series and NC79WA and NC79 for the 7900 series of microcomputers. You are kindly requested to circumvent these problems by the workarounds described below.
Problem 1. On #pragma PARAMETER
- Versions Concerned
| Product Names | Versions Concerned |
| NC77, NC77WA | V.3.00 Release 1 to V.5.00 Release 1 |
| NC79, NC79WA | V.1.00 Release 1 to V.3.00 Release 1 |
- Description
When calling a function defined by the #pragma PARAMETER directive, to pass the function itself as an argument to it may result in incorrect code being generated.
- Conditions
This problem occurs if the following two conditions are satisfied:
- A function defined by the #pragma PARAMETER directive is called.
- The above function takes its own return value as the first argument.
- Phenomenon
An incorrect argument is passed to the function called.
- Example
[C Source File]
-----------------------------------------------------------------------
extern int asm_func(int,int);
#pragma PARAMETER asm_func( X, Y )
main()
{
int i;
i = asm_func( asm_func( 3, 2 ), 1 );
}
-----------------------------------------------------------------------
- Workaround
Temporarily assign to TMP the return value from the function to be described as the first argument; then pass the return value to the first argument.
[C Source File]
-----------------------------------------------------------------------
extern int asm_func(int,int);
#pragma PARAMETER asm_func( X, Y )
main()
{
int i, tmp;
tmp = asm_func( 3, 2 );
i = asm_func( tmp, 1 );
}
-----------------------------------------------------------------------
Problem 2. On Initialization of Loops
- Versions Concerned
| Product Names | Versions Concerned |
| NC77, NC77WA | V.4.00 Release 1 to V.5.00 Release 1 |
| NC79, NC79WA | V.2.00 Release 1 to V.3.00 Release 1 |
- Description
Incorrect code for loops may be generated.
- Conditions
This problem occurs if the following four conditions are satisfied:
- Any of compile options -O, -OR, and -OS is used.
- A constant is assigned to a variable before the initial expression of a for/while statement.
Example: i = 10;
- To the above variable is assigned another variable in the initial expression of the loop.
Example: i = x;
- The looping condition of the for/while statement is comparison of the above variable with a constant.
Example: i < 5;
- Phenomenon
Incorrect code for the loop will be generated.
- Example
In the example shown below, the expression " i = 10; " is interpreted as the initial value, so the looping condition " i < 5 " is evaluated to be always false. Consequently, the code for the loop is not created by the reason that the code cannot be executed.
[C Source File]
-----------------------------------------------------------------------
int func(int x)
{
int i, j;
i = 10; /* Interpreted as the initial value */
j = 20;
for(i = x; i < 5; i++){
j += i;
}
return j;
}
-----------------------------------------------------------------------
- Workaround
Use the option "-Off=397" at compilation.
|
 |