 |
|
 |
RENESAS TOOL NEWS on April 16, 2004: RSO-M3T-NC30WA-040416D
A Note on Using C-Compiler Package M3T-NC30WA
|
Please take note of the following problem in using the M3T-NC30WA C-compiler package for the M16C/60,
M16C/30, M16C/Tiny, M16C/20, M16C/10, and R8C/Tiny series MCUs:
- On a multiplication between a variable of type unsigned/signed long and an immediate value
- Versions Concerned
M3T-NC30WA V.5.00 Release 1 through V.5.30 Release 1
- Description
Performing a multiplication between a variable of type unsigned/signed
long and an immediate value may result in the C compiler
being terminated forcefully with the following error message displayed:
The program has performed an illegal operation . . . .
- Conditions
This problem occurs if the following two conditions are satisfied:
| (1) | Any of the optimizing options O1, -O2, -O3, -O4, -O5, -O, -OR, and -OS is used. |
| (2) | A multiplication is performed between a variable of type unsigned/singed long and an immediate value of 0xffffffff. |
- Example
--------------------------------------------------------
unsigned long g; /* Condition (2) */
void func(void)
{
g = g * 0xffffffff; /* Condition (2) */
}
--------------------------------------------------------
- Workaround
This problem can be circumvented by going through the following steps:
| (1) | Define a temporary auto variable tmp. |
| (2) | Assign the immediate value 0xffffffff in Condition (2) to tmp. |
| (3) | Place a dummy asm function immediately after the assignment expression in (2). |
| (4) | Perform the multiplication between a variable and the temporary auto variable in (1) instead of the immediate value. |
Example:
----------------------------------------------------------------------
unsigned long g;
void func(void)
{
unsigned long tmp; /* Temporary auto variable tmp defined */
tmp = 0xffffffff; /* Immediate value assigned to tmp */
asm(); /* Dummy asm function placed */
g = g * tmp; /* tmp used instead of immediate value */
...
}
----------------------------------------------------------------------
- Schedule of Fixing the Problem
We plan to fix this problem in our next release of the product.
|
 |