 |
|
 |
MESC TOOL NEWS:
MESCT-NC79WA-990201D
Please take note of the following problems in using C compilers NC79WA (with assembler and integrated development environment) and NC79 for the 7900 series of microcomputers.
On the Casting of a Constant to a Pointer
- Versions Concerned
| Product Name | Versions |
| NC79WA/NC79 | V.2.00 Release 1 to V.3.00 Release 1 |
- Problem
When a constant is cast to a pointer, the address given by the constant may not correctly be accessed.
- Conditions
This problem occurs only if the following three conditions are satisfied:
(1) Option "-O", "-OR", or "-OS" is chosen.
(2)The value stored in the address given by a constant is changed by casting the constant to type pointer.
(3)Immediately after the above change of the value, the same constant described above is cast to the same type of pointer to read the value stored in the address given by the constant.
- Phenomenon
The value precedent to the one that has been changed by the first access of the pointer is referenced at the second access of the pointer.
- Example
[C Source File]
------------------------------------------------------------------
|
| void func(int i)
| {
| *(int *)0x9000 -= i;
| sub( *(int *)0x9000 ); /* the data before subtraction
| is performed in the previous
| line is used */
|
| }
|
------------------------------------------------------------------
- Workaround
Define the #pragma ADDRESS directive instead of casting a constant to a pointer.
Note: Make sure that the #pragma ADDRESS directive does not co-reside with the example C source file shown above.
[C Source File after Modification]
------------------------------------------------------------------
|
| #pragma ADDRESS adr 9000H
| int *adr;
|
| void func(int i){
| {
| *(int *)adr -= i;
| sub( *(int *)adr ); /* the data before subtraction
| is performed in the previous
| line is used */
|
| }
|
------------------------------------------------------------------
On Option "-Ostack_frame_align"
- Versions Concerned
| Product Name | Version |
| NC79WA | V.3.00 Release 1 |
- Problem
When a specific type of function is described, choosing option "-Ostack_frame_align" may produce the result opposite to the one intended.
- Conditions
This problem occurs only if the following two conditions are satisfied:
(1) Option "-Ostack_frame_align" is chosen.
(2) A function with no argument and auto variable is described.
- Phenomenon
The "-Ostack_frame_align" option does not act on functions with no argument and auto variable. On the other hand, the jsrl instruction pushes a 3-byte return address onto the stack. Then, the function called by a one with no argument and auto variable comes with such a return address that the beginning address of the stack saving it is always even.
- Workaround
Don't give the "-Ostack_frame_align" option to any file in which the above mentioned type of function exists.
|
 |