 |
|
 |
MESC TOOL NEWS:
MESCT-NC30WA_2-981001D
Please take note of the following problems in using C compilers NC30WA and NC30 for the M16C/60 series of microcomputers. You are kindly requested to circumvent these problems by the workarounds described below.
Versions Concerned
NC30WA and NC30 V.1.00 Release 1 to V.3.00 Release 2 affected.
Problem 1. On Arguments of Functions
- Description
Defining a function to take arguments with the same name may result in incorrect code being generated.
- Conditions
This problem occurs if the following three conditions are satisfied:
- A function is passed to a register.
- To obtain an argument described in 1 above, another function with the same name is called.
- The above function call is described as the first argument of the function in condition (1).
[C Source File]
-----------------------------------------------------------------------
int func(int,int);
main()
{
int i;
i=func(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.
Example
-----------------------------------------------------------------------
i=func(3,2);
i=func(i,1);
-----------------------------------------------------------------------
NC30WA, NC30 Precautions MESCT-NC30WA_2-981001D
Problem 2. On Bit Field Comparison
- Description
Bit field comparison may result in incorrect code being generated.
- Conditions
This problem occurs if the following two conditions are satisfied simultaneously:
- A logical operation between bit fields of one bit each is performed inside an expression to be evaluated in a conditional statement (i.e. if, while, for, switch, or ternary operator).
- A bit operator with higher priority exists at the right side of the expression, or a bitwise AND or bitwise OR operation in parentheses exists on the right of an operator.
This problem also occurs if one of the following conditions is satisfied.
- The result of an operation that an expression including bit fields of one bit each is unary-negated is used as a logical value for another operation.
- The result of an operation that an expression including bit fields of one bit each is compared with 1 or 0 (==, ! =) is used as a logical value for another operation.
- The result of an operation that an expression including bit fields of one bit each is unary-negated and compared with 1 or 0 (==, ! =) is used as a logical value for another operation.
Example 1
-----------------------------------------------------------------------
if(s.b0 | s.b1 & s.b2)
-----------------------------------------------------------------------
Example 2
-----------------------------------------------------------------------
if((!(s.b0 | (~s.b1 & s.b2))==1)&&(a==100))
-----------------------------------------------------------------------
- Workaround
- When any product of V.1.00 Release 1 through V1.00 Release 3 used
Give option "-Off=253" at compilation.
- When any product of V.2.00 Release 1 and later
Give option "-Off=353" at compilation.
NC30WA, NC30 Precautions MESCT-NC30WA_2-981001D
Problem 3. On "for" Statements
- Description
Init expressions in "for" statements may result in incorrect initialization.
- Conditions
This problem occurs if the following three conditions are satisfied:
- Any of options -O,-OR, and -OS is given at compilation.
- In a "for" or "while" statement, a loop condition is a comparison of a variable with a constant.
- Inside an init expression or before the "for" or "while" statement, a constant is assigned to a variable that is used in the loop condition.
Example
-----------------------------------------------------------------------
i=10;
for(i=x;i<10;i++){
-----------------------------------------------------------------------
- Workaround
- When any product of V.1.00 Release 1 through V1.00 Release 3 used
Give option "-Off=297" at compilation.
- When any product of V.2.00 Release 1 and later
Give option "-Off=397" at compilation.
NC30WA, NC30 Precautions MESCT-NC30WA_2-981001D
Problem 4. On Addition of long Constants
- Description
Addition of a long constant to a variable of type unsigned int may result in incorrect code being generated.
- Conditions
This problem occurs if the following two conditions are satisfied:
- An immediate value with qualifier long is added to a variable of type unsigned int.
- The lower 2 bytes of the immediate value with qualifier long are 0.
Example
-----------------------------------------------------------------------
unsigned int x;
unsigned long a;
a = 0x10000 + x;
-----------------------------------------------------------------------
- Workaround
Assign an int variable temporarily to a long variable; then, perform the operation.
|
 |