void f(int y){
x=1;
}
[Conditions]
This problem might occur when all of the following conditions were fulfilled.
(1) optimize=1 was specified.
(2) A conditional statement was described.
(3) A then or else clause of the conditional statement of (2) had an assignment expression (*1 in the above example).
(4) An assignment expression, in which the both sides had the same variable as the variable assigned to in (3), followed the
conditional statement of (2) (*2 in the above example).
3.3 Illegal Access with a Parameter Passed via the Stack
We have corrected the problem of an address for reference to a parameter passed via the stack being incorrect when the speed option was specified if a function with the parameter passed via the stack had a function call immediately before the exit.
[Example]
typedef struct {
int x;
} ST;
extern void g(ST *x);
void f(int a, ST b) { /* b is a parameter passed via the stack */
if (a) {
g(&b);
/* (A) */
}
/* (B) */
}
; Address where parameter b is stored at the function entry = R15
_f:
TST R4,R4
BT L12
MOV R15,R4
MOV.L L14,R2 ; _g
JMP @R2 ; (A)
ADD #4,R4 ; R4 <- R15+4 : Not the address of b
L12:
RTS ; (B)
NOP
[Conditions]
This problem might occur when all of the following conditions were fulfilled.
(1) optimize=1 was specified.
(2) The speed option was specified.
(3) The function had a parameter passed via the stack (b in the above example).
(4) The function had multiple exits ((A) and (B) in the above example).
(5) There was a function call immediately before any of the exits in (4) (g(&b); in the above example).
(6) (5) was the only function call in this function.
3.4 Illegal GBR Relative Logic Operation
We have corrected the problem of writing the result to an incorrect area if a logic operation with a 1-byte array or a bit-field member, for which #pragma gbr_base/gbr_base1 was specified, was performed.
[Example]
#pragma gbr_base a,b
char a[2],b[2];
void f() {
a[0] = b[0] & 1;
}
MOV #_b-(STARTOF $G0),R0
RTS
AND.B #1,@(R0,GBR) ; Writes the result of the operation to b[0]
[Conditions]
This problem might occur when all of the following conditions were fulfilled.
(1) gbr=user was specified.
(2) #pragma gbr_base/gbr_base1 was specified for any of the following variables:
- An (unsigned )char-type array
- A structure array that has an (unsigned )char-type member
- A structure that has an (unsigned )char-type array member
- A structure that has a bit-field member of 8 bits or less
(3) A logic operation of a constant (&, |, ^) with the variable of (2) (b[0] in the above example) was performed.
(4) The variable assigned to by the operation of (3) (a[0] in the above example) fulfilled the condition of (2).
(5) Variables of (3) and (4) were different variables, different elements of the same array, or different members of the same
structure.
3.5 Illegal Elimination of Sign/Zero Extension
We have corrected the problem of eliminating the cast when the address of a variable/constant or the index of an array was cast to 1 or 2 bytes and this value was used for accessing memory, or the expression which was cast to a char type was assigned to an unsigned short type variable and the result was used for comparison.
[Example1]
unsigned short x;
char a[1000];
void f() {
a[(char)x] = 0;
}
MOV.L L11+2,R2 ; _x
MOV.L L11+6,R6 ; _a
MOV.W @R2,R5
EXTU.B R5,R0
; Eliminates EXTS.B R0,R0
MOV #0,R5 ; H'00000000
RTS
MOV.B R5,@(R0,R6) ; When x is not within the range of 0 to 127,
; an illegal address may be referred to.
[Example2]
unsigned short us0;
unsigned int b;
func1() {
unsigned short us1;
us1 = (char)b;
return(us0 !=us1);
}
MOV.L L11,R2 ; _b
MOV.L L11+4,R5 ; _us0
MOV.L @R2,R6
EXTS.B R6,R2
MOV.W @R5,R6
EXTU.W R6,R5
CMP/EQ R2,R5 ; (char)b is not cast to an unsigned short type
; and is used in comparison.
MOVT R0
RTS
XOR #1,R0
[Conditions]
This problem might occur when all of the following conditions were fulfilled.
(1) optimize=1 was specified.
(2) One of the following conditions (a)(b) was satisfied.
(a-1) The address of a variable/constant or the index of an array was explicitly cast to 1 or 2 bytes.
(a-2) The value of (a-1) was used for accessing memory.
(b-1) The expression which was cast to a char type was assigned to an unsigned short type variable.
(b-2) The variable of (b-1) was used in comparison.
3.6 Former Limitation
We have corrected the following problem:
When addition and subtraction of a section address operator and a numeric value were described to the initial value of an external variable, the portion of numerical addition and subtraction was not output in an object.
[Example]
char *addr1 = (char *)__sectop("P"); // OK
char *addr2 = (char *)__sectop("P") + __secsize("P"); // OK
char *addr3 = (char *)__sectop("P") + 10; // NG
3.7 Internal Errors Corrected
We have corrected the problem of generating internal errors under the following conditions:
A C++ program, which only had declaration of a class that includes a static function member declaration using the
function-type typedef, was compiled with the debug option specified.
A C/C++ program, which includes a switch statement that is not enclosed by {} and had no default label, was compiled with optimize=0 and the debug option specified.
| 4. Optimizing Linkage Editor |
4.1 Illegal output data for an empty area in S-Type/HEX format files
The following problem had been fixed:
When an output file format is S-Type (or HEX), "0" character (ASCII-code:0x30) might be incorrectly changed to NULL (ASCII-code:0x00) at an empty area in which no instruction or data exists.
[Condition]
This problem might occur when all of the following conditions were fulfilled.
(1) The endian=little option was specified for the compiler (or assembler).
(2) The form=stype(or hexadecimal) option was specified for the linker.
(3) The code (or data) linked to the same section are divided and exist in two or more input object files.
(4) "0" was inserted in the section of (3) by boundary adjustment at the linkage process.
4.2 Illegal object due to specification of unifying same codes optimization
Fixed the problem that a branch to the unified subroutine might be incorrect.
[Condition]
This problem might occur when all of the following conditions were fulfilled.
(1) Unifying same codes optimization (optimize=same_code) was valid.
(2) The input file was compiled with the goptimize option.
(3) Two or more unified subroutines were generated by optimization.
(4) A distance between the generated subroutines of (3) was 4096 bytes or less.
4.3 Incorrect error with specification of the change_message option
Fixed the problem that an incorrect error occurred when two or more error levels were specified in the change_message option.
[Example]
When the change_message option was specified as follows, a linker older than version 8.0.03 output an error message incorrectly:
optlnk -change_message=e=1000,w=2000 *.obj