 |
|
 |
MESC TOOL NEWS:
MESCT-NC79WA_2-991216D
Please take note of the following problem in using C compiler (with assembler and integrated development environment) NC79WA for the 7900 series of microcomputers:
-
Versions Concerned
NC79WA V.3.10 Release 1 -- V.3.10 Release 2
-
Problem
When a data piece of type unsigned char is converted to of type unsigned or signed long, the upper most 1 byte may become indeterminate.
-
Conditions
This problem occurs if the following two conditions are satisfied:
- (1)A data piece of type unsigned char is converted to of type unsigned or signed long.
- (2)An operation of type unsigned or signed char where data length is 8 bits is performed immediately before (1) above. Since this operation is involved in the condition only when it outputs instructions affected by the status of the M flag (cheq, div etc.), check these instructions using the assembly language source file created with command option -S.
-
Example
---------------------------------------------------------------
unsigned long l;
void func(char c,char d)
{
char e;
e = c / d; <------- Condition (2)
l = e; <------- Condition (1)
}
---------------------------------------------------------------
-
Workaround
This problem will be circumvented by either of the following ways:
(1)Use the asm function
[ Modification of the Above Example ]
---------------------------------------------------------------
unsigned long l;
void func(char c,char d)
{
char e;
e = c / d;
asm( 0,0 ); <-------- M flag cleared by asm function just before
processing of (1)
l = e;
}
---------------------------------------------------------------
(2)Mask the upper most 1 byte by 0 after data is converted into of type long
---------------------------------------------------------------
unsigned long l;
void func(char c,char d)
{
char e;
e = c / d;
l = (e & 0x0fffffffL);
}
---------------------------------------------------------------
-
Schedule of Fixing Problem
This problem was resolved in the upgraded version, NC79WA V.3.20 Release 1, released on December 16, 1999.
|
 |