 |
|
 |
RENESAS TOOL NEWS on August 1, 2006 060801/tn3
| A Note on Using the C Compiler Packages
--M3T-NC308WA and M3T-NC30WA--
for the M16C MCU Family
--On Using Two if Statements Successively-- |
Please take note of the following problem in using the C compiler packages
--M3T-NC308WA and M3T-NC30WA--for the M16C MCU family:
- On using two if statements successively
- Products and Versions Concerned
- The M3T-NC308WA V.5.00 Release 1 through V.5.20 Release 02
(the C compiler package for the M32C/90, M32C/80, and M16C/80 series)
- The M3T-NC30WA V.5.00 Release 1 through V.5.30 Release 02
(the C compiler package for the M16C/60, M16C/30, M16C/20, M16C/10, M16C/Tiny, and R8C/Tiny series)
- Description
Using two if statements successively may not generate any code for conditional jumps.
- Conditions
This problem occurs if the following conditions are all satisfied:
| (1) |
|
Two if statements are successively used in the program. |
| (2) |
|
The first if statement in (1) has no true statement. |
| (3) |
|
In the controlling expressions of these two if statements, the same variable is used for two comparisons. |
| (4) |
|
The variable in (3) is compared with the same variable or the same constant expression. |
| (5) |
|
The operators used in the comparisons in (3) are both ==, or == and !=. Or the operators are omitted. |
| (6) |
|
Any of these optimizing options, -O3, -O4, -O5, -OR, -OS, -OR_MAX(-ORM), and -OS_MAX(-OSM) is used. |
Example:
---------------------------------------------------------------------
long a;
long b;
void func(void)
{
signed char data =0;
long l;
if(b >=0)
l = b ;
else
data = 1;
if(data){ /* Conditions (1), (3), (4), and (5) */
} /* Condition (2) */
if(data) /* Conditions (1), (3), (4), and (5) */
b = l;
}
---------------------------------------------------------------------
- Workaround
Use a dummy asm function as a true statement of the first if statement in Condition (2) above.
- Schedule of Fixing the Problem
This problem has already been fixed in the latest versions of the Products. So please update yours to either or both of the following:
- The M3T-NC308WA V.5.40 Release 00
- The M3T-NC30WA V.5.40 Release 00A
|
 |