Technical information

Operating Precautions for CPDW9X/NT-CDR-V85X, Y-GHS-MULTI-V800
TM
Customer Notification r20tu0003ed1812 19
No. a8
Compiler generates incorrect code for exclusive-or-operation
Version Information
V3.3
Details
The Compiler generates incorrect code for “exclusive-or-operation” in combination with space
optimization OS and compiler driver option –reserve_r2. The “xori” instruction is not insert by the
compiler, because the peephole optimizer does not alter instructions whose condition codes were
needed.
Example:
test.c:
#define TRUE 1
#define FALSE 0
extern unsigned int foo(unsigned char a)
{
return(0xA8FF);
}
extern unsigned char test(void)
{
if( (foo(0)^0xFFFF) & 0x8000) return TRUE;
return FALSE;
}
Command Sequence
ccv850 list c -noobj -OS -reserve_r2 v010927a.c
test.s:
_test:
jarl ___ghssavelpa,r10
mov 0,r6 -- .bf
jarl _foo,lp
shr 16,r10
bnl .L19
mov 1,r9
br .L17
.L19:
mov 0,r9
.L17:
mov r9,r10 -- .ef
jarl ___ghsloadlp,lp
Workaround
Use option -Onopeep to disable the peephole optimization.