 |
|
 |
MESC TOOL NEWS:
MESCT-NC308WA-000801D
NC308WA, NC30WA, NC79WA, and NC77WA Precautions
|
Please take note of the following problems in using C compilers (with assembler and integrated development environment)
NC308WA for the M16C/80 series;
NC30WA for the M16C/60 and M16C/20 series;
NC79WA for the 7900 series; and
NC77WA for the 77xx series
of MCUs:
- Converting the type of floating-point constants to the unsigned long one may cause their values to become incorrect.
-
Problem 1: Converting the type of floating-point constants to
the unsigned long one may cause their values to become incorrect
- 1.1 Versions Concerned
- NC308WA V.1.00 Release 1 -- V.3.00 Release 1
- NC30WA V.1.00 Release 1 -- V.4.00 Release 1
- NC79WA V.2.00 Release 1 -- V.4.00 Release 1
- NC77WA V.3.00 Release 1 -- V.5.20 Release 2
-
Note: NC308WA V.3.00 Release 1, NC30WA V.4.00 Release 1, and NC79WA V 4.00 Release 1 are due to be released in September 2000.
- 1.2 Conditions
- This problem occurs if the following two conditions are satisfied:
- (1) A floating-point constant is converted to the one of type unsigned long in any of the following ways:
- (a) A floating-point constant only is described in the initializer of a variable of type unsigned long.
- (b) A floating-point constant is assigned to a variable of type unsigned long.
- (c) A floating-point constant is passed to a function's argument of type unsigned long.
- (d) A floating-point constant is explicitly casted to the one of type unsigned long.
- (2) The value of the floating-point constant described in (1) is
greater than 2147483647 (LONG_MAX) and equal to or less than 4294967295 (ULONG_MAX).
- 1.3 Example
-------------------------------------------------------------------------------
unsigned long ul1 = 3000000000.0; /* Example 1: Conditions (1)-(a)
and (2) */
unsigned long ul2;
void sub(unsigned long);
void func(void)
{
ul2 = 3000000000.0; /* Example 2: Conditions (1)-(b)
and (2) */
sub(3000000000.0); /* Example 3: Conditions (1)-(c)
and (2) */
ul2 -= (unsigned int)3000000000.0; /* Example 4: Conditions
(1)-(d) and (2) */
}
-------------------------------------------------------------------------------
- 1.4 Workaround
- Describe floating-point constants that are to be converted to those of type unsigned long in integer constants.
------------------------------------------------------------------------------
unsigned long ul1 = 3000000000UL; /* Workaround 1: The type of
unsigned long is explicitly shown */
unsigned long ul1 = 3000000000; /* Workaround 2: The type is
determined by the value if no suffix
exists */
------------------------------------------------------------------------------
- 1.5 Schedule of Fixing Problem
- We plan to fix this problem in our next release.
|
 |