 |
|
 |
MESC TOOL NEWS:
MESCT-CC32R-000616D
Please take note of the following problem in using cross-tool kit CC32R for the M32R family of microcomputers:
-
Versions Concerned
CC32R V.1.00 Release 1 -- V.2.10 Release 1
-
Problem
When a function is called which returns a structure not an integer multiple of 4 bytes in size, and the return value is not referenced by any expression, the value of the stack pointer after the function call becomes incorrect.
- 2.1 Conditions
- This problem occurs if the following three conditions are satisfied:
- (1) In the program exists a structure (including bit fields) or union that is not an integer multiple of 4 bytes in size.
- * To calculate the size of a structure or union, see Chapter 5 "Internal Data Representation" in the C Compiler part of the CC32R User's Manual.
- (2) Also in the program exists a function that returns such a structure or union as described in (1).
- (3) The function described in (2) is called without assigning its return value to any variable.
- 2.2 Example
-
-------------------------------------------------------------------
struct S { /* Condition (1): Structure S is 2 bytes wide */
char m1;
char m2;
};
extern struct S func(void); /* Condition (2): Function returns
structure S */
void foo(void)
{
func(); /* Condition (3): Function called with
its return value not assigned */
}
-------------------------------------------------------------------
-
Workaround
This problem will be circumvented by either of the following ways:
- (1) Change the size of the structure into an integer multiple of 4 bytes.
- In the example shown in 2.2 above
-
[Modified]
-------------------
struct S {
char m1;
char m2;
short dummy;
};
-------------------
[Original]
-------------------
struct S {
char m1;
char m2;
};
-------------------
- (2) At calling a function in condition (3), assign its return value to any variable.
- In the example shown in 2.2 above
-
[Modified]
-------------------
void foo(void)
{
struct S dummy;
dummy = func();
}
-------------------
[Original]
-------------------
void foo(void)
{
func();
}
-------------------
-
Schedule of Fixing Problem
We plan to fix this problem in our next release.
|
 |