 |
|
 |
MESC TOOL NEWS:
MESCT-CC32R-991216D
Please take note of the following problems in using cross-tool kit CC32R for
the M32R family of microcomputers:
-
On "Switch" Statements Constructed of Specific Case Labels
- 1.1 Versions concerned
- CC32R V.1.00 Release 1 -- V.2.00 Release 1
- 1.2 Problem
- In the particular switch statement executions, incorrect case labels are sometimes selected.
- 1.3 Conditions
- This problem occurs if the following two conditions are satisfied:
- (1)The expression controlling a "switch" statement is of type unsigned long or unsigned int.
- (2)The expressions (here constants) used as the values of case labels satisfy either of the following conditions, (a) and (b):
- (a)The constants contain 0 and -1, and the number of consecutive constants is five or more.
- (b)The constants contain 0 and 0xffffffff, and the sum of the number of consecutive constants greater than or equal to 0 and the one less than or equal to 0xffffffff is five or more.
-
Example: Conditions (1) and (2)-(b) satisfied
------------------------------------------------------
int
func(unsigned long data)
{
switch(data) { (1)
case 0: (2-b)
return 10;
case 1: (2-b)
return 20;
case 2: (2-b)
return 30;
case 0xfffffffe: (2-b)
return 40;
case 0xffffffff: (2-b)
return 50;
}
return 0;
}
------------------------------------------------------
The code generated from the above C language program,
will select incorrect case labels according to their values of data
as shown in the table below.
Note that the its behavior does not depend on their order of description.
| Value of "data" | Replacing "case" Label |
0xfffffffe 0xffffffff 0 1 2 | case 0: case 1: case 2: case 0x000000fe: case 0x000000ff: |
- 1.4 Workaround
- Rewrite the "switch" statement into the equivalent "if" statement.
CC32R Precaution MESCT-CC32R-991216D
-
On Programs Handling Members of a Structure in a Loop
- 2.1 Versions concerned
- CC32R V.1.00 Release 1 -- V.2.00 Release 1
- 2.2 Problem
- The values of members of a structure in a loop cannot be updated.
- 2.3 Conditions
- This problem occurs if the following five conditions are satisfied:
- (1) Any of optimizing option -O4, -O5, -O6, and -O7 is chosen. (The case where only -Ospace or -Otime is used as an optimizing option is included.)
- (2) Any int-type member variable of a structure or union is referenced outside a loop statement(a "while", "for", or "do while" statement).
- (3) The same member variable that is described in (2) is referenced also inside the loop statement in (2) above; then, the value of the variable is updated inside of it using a simple assignment operator (=), not other assignment operators.
- (4) The member variables described in (2) and (3) are referenced in the conditional expression inside the loop statement in (2).
- (5) The substances of (3) and (4) are described in this order inside the loop statement in (2).
-
Example
------------------------------------------------------
struct t {
char x;
};
char y;
void dummy(struct t val)
{
y = val.x; (2)
while (1) {
val.x = val.x + 1; (3),(5)
if (val.x) break; (4),(5)
}
}
------------------------------------------------------
In the code generated from the above C language program,
no assignment is done to "val.x" inside the "while" loop.
- 2.4 Workaround
- This problem will be circumvented by either of the following ways:
- (1)Choose any of -O1, -O2, and -O3 as an optimizing option.
- (2)Declare the structure or union to which the member variable belongs to be volatile. (In the above example, declare the "struct t val" variable to be volatile.)
|
 |