 |
|
 |
MESC TOOL NEWS:
MESCT-CC32R-991016D
Please take note of the following problem in using cross-tool kit CC32R for the M32R family of microcomputers.
- Versions Concerned
CC32R V.1.00 Release1 -- V.2.00 Release1
- Problem
When compiling files written in the C language which include conditional statements expressions that compares constant 1 with the result of an operation, codes that incorrectly compare positions between bits may be generated. In such a case, conditional branches will not be performed correctly.
- Conditions
This problem occurs if the following three conditions are satisfied:
- 3.1 An optimizing option (-O1, -O3, -O5, or -O7) is used at compilation.
- 3.2 Codes generated at compilation are maintained to function the register for making decision of branches at the end of the execution sequence.
- 3.3 Any of the following conditional expressions is described in a C-language source file:
- (1)a conditional expression that compares (==,!=) constant 1 with the result of a division operation where
- (2)a conditional expression that compares (==,!=) constant 1 with the result of a right shift operation where
- (3)A conditional expression that compares (==,!=) constant 1 with such a member variable of a bit field that
- Workaround
This problem will be circumvented by either of the following ways:
- (1)Modifying the source program
- Temporarily assign the result of an operation or a variable in a conditional expression to an external variable declared as volatile;
then use the external variable in the above conditional expression.
-
[Example of modifying the conditional expression in 3.3-(2) above]
------------------------------------------------------------------
| volatile unsigned int tmp;
| void foo()
| {
| unsigned int a;
|
| tmp = a >> 31;
| if (tmp == 1) {
| ....
| }
| ...
| }
------------------------------------------------------------------
- (2)Changing optimizing options
- Use an optimizing option -O2, -O4, or -O6 in place of -O1, -O3, -O5, or -O7.
|
 |