 |
|
 |
MESC TOOL NEWS:
MESCT-NC30WA-990701D
NC30WA V.3.10 Release1
Precaution
|
Please take note of the following problems in using C compiler (with assembler and integrated development environment) NC30WA V.3.10 Release1 for the M16C/60 and M16C/20 series of microcomputers.
On "inline" Function
- Problem
If "inline" functions take arguments pushed on the stack, they may not be correctly accessible.
- Conditions
This problem occurs if the following two conditions are satisfied:
(1)An "inline" function takes an argument, which is pushed on the stack.
(2)The "inline" function contains no auto variable.
[Example]
----------------------------------------------------------------------
| void in_func(long k);
|
| inline void in_func(long k)
| {
| k=1;
| }
|
----------------------------------------------------------------------
- Workaround
Describe a dummy auto variable in the "inline" function by using an "asm(";$$", a dummy variable);" statement; otherwise, the area for the auto variable will not be reserved.
[Example]
----------------------------------------------------------------------
| void in_func(long k);
|
| inline void in_func(long k)
| {
| char c;
| asm(";$$",c);
| k=1;
| }
|
----------------------------------------------------------------------
NC30WA V.3.10 Release1 Precaution MESCT-NC30WA-990701D
On Shifting Variables by 0 Bits
- Products Concerned
NC30WA V.3.00 Release 1 -- NC30WA V.3.00 Release 2
NC30WA V.3.10 Release 1
- Problem
Shifting a variable of type long to the right by 0 bits may result in no code being generated.
- Conditions
This problem occurs if the following two conditions are satisfied:
(1)A variable of type unsigned long is shifted right 0 bits.
(2)The result of the shift operation is assigned to another variable.
[Example]
----------------------------------------------------------------------
| main(){
| long k,m;
| m=k>>0;
| }
|
----------------------------------------------------------------------
- Workaround
Use an assignment expression instead of a shift operation the shift count of which is 0.
[Example]
----------------------------------------------------------------------
| main(){
| long k,m;
| m=k;
| }
|
----------------------------------------------------------------------
NC30WA V.3.10 Release1 Precaution MESCT-NC30WA-990701D
On "Less Than" Comparison of a Variable of Type "long" with 0
- Problem
When the value of a variable of type long declared to be "far" is compared with 0, the warning " 16-bits unsigned value is out of range 0 -- 65535. address='xxxx' " may be displayed at linking.
- Conditions
This problem occurs if the following three conditions are satisfied:
(1)A comparison is made of the value of a variable of type long and 0.
(2)The variable of type long is declared to be "far".
(3)The "less than" operator '<' is used to compare the values.
[Example]
----------------------------------------------------------------------
| far long k;
| func()
| {
| if(k<0)
| -------
| }
|
----------------------------------------------------------------------
- Workaround
Circumvent the problem by either of the following methods:
(1)Compare the variable of type long with -1 by using the "less than or equal to" operator "<=".
[Example]
----------------------------------------------------------------------
| far long k;
| func()
| {
| if(k<=-1)
| -------
| }
|
----------------------------------------------------------------------
(2)Temporarily assign the variable of type long to a TMP variable; then make a "less than" comparison of this with 0.
[Example]
----------------------------------------------------------------------
| far long k;
| func()
| {
| far long tmp=k;
| if(tmp<0)
| -------
| }
|
----------------------------------------------------------------------
|
 |