Technical information
Operating Precautions for CPDW9X/NT-CDR-V85X, Y-GHS-MULTI-V800
TM
Customer Notification r20tu0003ed1812 25
No. a14
Compiler generates incorrect code for infinite loop
Version Information
V3.5
Details
Compiler incorrectly removes calls within an infinite loop by using standard optimization
option “–O”.
Example:
test.c:
unsigned short test(unsigned short, unsigned char);
unsigned short a[6], b[6];
unsigned char c;
void main(void)
{
c = 0;
b[3] = 0x8000;
b[4] = 0x8000;
b[5] = 0x8000;
for(;;)
{
a[3] = test(b[3], c);
a[4] = test(b[4], c);
a[5] = test(b[5], c);
}
}
Command Sequence
ccv850 –list –c -noobj -O test.c
test.s:
_main:
add -4,sp
st.w lp,0[sp]
movhi hi(_c),zero,r10
st.b zero,lo(_c)[r10]
ori 32768,zero,r2
movhi hi(_b),zero,r11
movea lo(_b),r11,r11
st.h r2,6[r11]
st.h r2,8[r11]
andi 65535,r2,r10
mov r11,r2
.L6:
st.h r10,10[r2]
br .L6
Workaround
A new compiler, which fixes this problem, can be downloaded from the NEC WEB page(s) at
http://www.renesas.eu/updates?id=443










