 |
|
 |
RENESAS TOOL NEWS on October 16, 2003: RSO-M3T-NC308WA_1-031016D
A Note on Using C Compiler M3T-NC308WA
|
Please take note of the following problem in using the M3T-NC308WA C compiler (with an assembler and integrated development environment) for the M32C/80 and M16C/80 series MCUs:
- On comparing a variable with another one or a constant of type signed char in a conditional expression
- Versions Concerned
The M3T-NC308WA V.3.00 Release 1 through V.5.10 Release 1
for the M32C/80 and M16C/80 series MCUs
- Description
Comparing a variable with another one or a constant of type signed char in a conditional expression may result in a system error.
- 2.1 Conditions
- This problem occurs if the following four conditions are satisfied:
| (1) | A variable of type signed char is compared with another one or a constant of type signed char in the conditional expression of an if statement. |
| (2) | The if statement in (1) is not followed by any else statement. |
| (3) | The program statement executed when the result of comparison in (1) is TRUE is only the processing that assigns the variable/constant with the smaller value to the variable/constant with the larger one. |
| (4) | Any of these optimizing options, -O1, -O2, -O3, -O4, -O5, -OS, and -OR, is used. |
- 2.2 Example
---------------------------------------------------
signed char func( signed char c, signed char d )
{
if( c > d ){ /* Conditions (1) and (2) */
c = d; /* Condition (3) */
}
return c;
}
---------------------------------------------------
- Workaround
In the if statement, place a dummy asm function immediately after the program statement that is executed when the result of comparison in the conditional expression is TRUE.
---------------------------------------------------
signed char func( signed char c, signed char d )
{
if( c > d ){
c = d;
asm(); /* A dummy asm function */
}
return d;
}
---------------------------------------------------
- Schedule of Fixing the Program
We plan to fix this problem in our next release of the product.
|
 |