 |
|
 |
MESC TOOL NEWS:
MESCT-NC30WA-000516D
Please take note of the following problems in using C compiler (with assembler and integrated development environment):
-
Versions Concerned
NC30WA V.2.00 Release 1 -- V.3.20 Release 2
for the M16C/60 and M16C/20 series MCUs
-
Problem on Transferring a Variable to a Bit Field
Transferring a variable to a member of a bit field which is 2 bits wide or more results in incorrect code being generated.
- 2.1. Conditions
- This problem occurs if the following three conditions are satisfied:
- (1) The transfer destination is a member of a bit field which is 2 bits wide or more.
- (2) The member of a bit field is of type int declared to be "far".
- (3) The transfer source is an auto variable of type char.
- 2.2. Example in C-Language Source File
-
---------------------------------------------------------------
far struct {
unsigned int b0:5;
}bit;
unsigned char c;
bit.b0=c;
---------------------------------------------------------------
- 2.3. Workaround
- Temporarily assign the auto variable of type char of the transfer source into a temporary auto variable of type int; then transfer it to a member of a bit field.
-
---------------------------------------------------------------
far struct {
unsigned int b0:5;
}bit;
unsigned char c;
unsigned int tmp;
tmp=c; /* Assigned to a temporary variable */
bit.b0=tmp;
---------------------------------------------------------------
- 2.4. Schedule of Fixing Problem
- We plan to fix this problem in our next release.
NC30WA Precaution MESCT-NC30WA-000516D
-
Problem on Testing the True/False of a Variable of Type Long Masked with an Immediate Value
Performing the test of whether a variable of type long masked with an immediate value is equal to 0 results in incorrect code being generated.
- 3.1. Conditions
- This problem occurs if the following five conditions are satisfied:
- (1) A variable of type long is bitwise-ANDed with an immediate value.
- (2) The immediate value is such that more than one bit is set to 1. So the following values are not concerned in this problem: 0x0000001, 0x00020000, etc.
- (3) The result of (1) is tested in the conditional expression to see if it is equal to 0.
- (4) The program statement executed if the result of the test is TRUE is a single assignment statement to a variable of type char.
- (5) After the "if" statement no "else" statement exists.
- 3.2. Example in C-Language Source File
-
---------------------------------------------------------------
long int l;
char c;
:
if((l & 0x00ffff00) ==0)
c=0;
---------------------------------------------------------------
- 3.3. Workaround
- Place a dummy "asm" function immediately before the program statement executed if the test is TRUE as follows:
-
---------------------------------------------------------------
long int l;
char c;
:
if((l & 0x00ffff00) ==0){
asm(""); /* A dummy "asm" function */
c=0;
}
---------------------------------------------------------------
- 3.4. Schedule of Fixing Problem
- We plan to fix this problem in our next release.
|
 |