 |
|
 |
MESC TOOL NEWS:
MESCT-CC32R-980216D
Please care about the problem described below which may occur when the cc32r C-compiler included in cross-tool kit CC32R for the M32R family of microcomputers is running.
Versions Concerned
All the versions before CC32R V.1.00 Release 3 are affected.
Version numbers are examined by giving a start-up option "V" to cc32r.
- CC32R V.1.00 Release 1
- CC32R V.1.00 Release 2
- CC32R V.1.00 Release 3
Conditions under Which Problem Occurs
- Options including optimization level 2 (-O2, -O3, -O6, -O7, -O, and Otime only, or -Ospace only) are given at compiling.
- Constants or variables (including calculated results) are assigned to bit field variables.
- The types of bit field variables above in 2. are char, unsigned char, short, or unsigned short.
- The width of bit field variables above in 2. is 1-7 or 9-15.
- Bit field variables above in 2. are referenced.
- Statements of function call or branch do not exist between the assignment above in 2. and the reference above in 5.
- Assignments to other bit field variables do not exist between the assignment above in 2. and the reference above in 5.
Example of Description
-------------------------------------------------------------------
struct bit {
unsigned char x: 2; /* <- conditions 3., 4. */
} st;
int tmp;
void foo( void )
{
st.x = tmp; /* <- condition 2. */
/* <- conditions 6., 7. */
if( st.x ) { /* <- condition 5. : Bit-field variables
may not be correctly referenced */
:
}
}
-------------------------------------------------------------------
Workaround
Please work around the error by using any one of the following ways:
- Compile the source file by giving the options not including optimization level 2 (-O0, -O1, -O4 and -O5) as optimizing options.
- Change the char and the short type of bit field variables to the int type, and the unsigned char and the unsigned short type of them to the unsigned int type.
---------------------------------------------------------------------
struct bit {
unsigned int x: 2; /* <- change to unsigned int */
} st;
int tmp;
void foo( void )
{
st.x = tmp;
if( st.x ) {
:
}
}
---------------------------------------------------------------------
- Perform AND operation with the maximum value of field width when referencing bit field variables.
-----------------------------------------------------------------
struct bit {
unsigned char x: 2;
} st;
int tmp;
void foo( void )
{
st.x = tmp;
if( st.x & 3 ) { /* AND operation performed with
maximum value of bit field
width (3, in this case) */
:
}
}
-----------------------------------------------------------------
|
 |