 |
|
 |
RENESAS TOOL NEWS on January 16, 2004: RSO-M3T-NC308WA_1-040116D
A Note on Using C Compilers M3T-NC308WA and M3T-NC30WA
|
Please take note of the following problem in using the M3T-NC308WA and
M3T-NC30WA C-compilers (with an assembler and integrated development
environment):
- On defining array-type variables
- Products and Versions Concerned
M3T-NC308WA V.5.00 Release 1 and V.5.10 Release 1
for the M32C/80 and M16C/80 series
M3T-NC30WA V.5.10 Release 1 and V.5.20 Release 1
for the M16C/60, M16C/30, M16C/Tiny, M16C/20, M16C/10, and R8C/Tiny series
- Description
If two or more array-type external variables with the same name are defined,
incorrect code may be generated at compilation without interpreting it as an error.
- Conditions
This problem occurs if the following two conditions are satisfied:
| (1) |
Two or more array-type external variables with the same name are defined.
|
| (2) |
The array-type variables in (1) are different from each other in the number of elements.
|
- Examples
Example 1
--------------------------------------------------------
extern char a[10];
char a[20];
--------------------------------------------------------
Example 2
--------------------------------------------------------
char b[10];
extern char b[20];
--------------------------------------------------------
Example 3
--------------------------------------------------------
char c[10];
char c[20];
--------------------------------------------------------
In these examples, the code for reserving a 10-byte RAM area is generated for each of the variables a, b,
and c without interpreting them as errors.
(To each variable necessary memory is allocated to accommodate the number of elements declared at first.)
- Workaround
Define two or more array-type variables with the same name such a way that their numbers of elements are the same.
Example 1
--------------------------------------------------------
extern char a[20];
char a[20];
--------------------------------------------------------
Example 2
--------------------------------------------------------
char b[20];
extern char b[20];
--------------------------------------------------------
Example 3
--------------------------------------------------------
char c[20];
char c[20];
--------------------------------------------------------
- Schedule of Fixing the Problem
We plan to fix this problem in our next release of the products.
|
 |