 |
|
 |
RENESAS TOOL NEWS [RSO-M3T-NC308WA_1-030601D]
|
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 arithmetic right shift of a variable of type long long
- Versions Concerned
- The M3T-NC308WA V.5.00 Release 1 and V.5.10 Release 1
- for the M32C/80 and M16C/80 series MCUs
- Description
Arithmetically right shifting a variable of type signed long long and then storing the result back into the variable causes incorrect code to be generated.
- Example
-------------------------------------------------------------------
long long l;
void func( char c )
{
l >>= c; /* The result of arithmetically right shifting a
variable is stored back into it */
}
-------------------------------------------------------------------
- Workaround
Assign the variable to be shifted to a temporary variable; next, arithmetically right shift the latter; then store the result of shift into the former.
-------------------------------------------------------------------
long long l;
void func( char c )
{
long long tmp; /* Temporary variable tmp defined */
tmp = l; /* Variable l is assigned to tmp */
l = tmp >> c; /* The result of arithmetically right shifting
tmp stored back into variable l */
}
-------------------------------------------------------------------
- Schedule of Fixing the Problem
We plan to fix this problem in our next release of the product.
|
 |