 |
|
 |
MESC TOOL NEWS:
MESCT-NC79WA-980916D
NC79WA V.3.00 Release 1 Precaution
|
Please take note of the following problem in using C compiler NC79WA V.3.00 Release 1 (with assembler and integrated tool manager) for the 7900 series of microcomputers. You are kindly requested to circumvent this problem by the workaround described below.
Problem at Accessing Arrays of Type far
- Description
Arrays of type far with data size of greater than 32 Kbytes and less than or equal to 64 Kbytes may not be accessed correctly.
- Conditions
This problem occurs if the following four conditions are satisfied:
- Members of a multidimensional array or a structure are arrays or pointers to arrays.
- The size of the array (including a sub-array in a multidimensional array) is greater than 32 Kbytes and less than or equal to 64 Kbytes.
- The type of subscripts of the array is any of type signed char, unsigned char, or signed int.
- An element of the array whose area is greater than the 32 Kbytes and less than or equal to the 64 Kbytes from the beginning of the array is accessed.
- Phenomenon
When the element is accessed as described in the condition 4 above, it is not done but another address is referenced instead.
- Example
[C source file]
-----------------------------------------------------------------------
typedef struct {
char ch[256];
} mytype;
far mytype array[0xc0];
far struct {
mytype array[0xc0];
} st, *pst;
far mytype array2[2][0xc0];
far mytype (*p2a)[0xc0];
signed int iii;
signed int jjj, kkk;
void func(void)
{
array[iii]; /* OK */
/* A member of the structure is an array */
st.array[iii]; /* NG */
pst->array[iii]; /* NG */
/* A multidimensional array
Size of array2 = 2*192*256 = 0x18000
Size of array2[jjj] = 192*256 = 0xc000
Though the size of array2 exceeds 64 Kbytes, that of array2[jjj]
is greater than 32 Kbytes and less than 64 Kbytes (no good)
*/
(*array2)[kkk]; /* NG */
array2[jjj][kkk]; /* NG */
/* A pointer to an array */
(*p2a)[kkk]; /* NG */
p2a[jjj][kkk]; /* NG */
}
-----------------------------------------------------------------------
- Workaround
Cast the type of subscripts of the array to "unsigned int".
Example: st.array[(unsigned int)iii];
pst->array[(unsigned int)iii];
|
 |