Technical information
Operating Precautions for CPDW9X/NT-CDR-V85X, Y-GHS-MULTI-V800
TM
Customer Notification r20tu0003ed1812 26
No. a15
Compiler generates incorrect code for a loop followed by a “#pragma asm” construct
Version Information
V3.3, V3.5
Details
Compiler incorrectly in-lines the assembler sequences into the for-next loop.
Example:
void foo(int a);
void main(void)
{
int i;
for ( i = 0; i<10 ; i++)
{
foo(i);
}
#pragma asm
stsr PSW,r2
ori 0x80,r2,r2
ldsr r2,PSW
#pragma endasm
}
Command Sequence
ccv850e -c –noobj -list test.c
test.s:
_main:
add -8,sp
st.w lp,4[sp]
st.w r29,0[sp]
mov 0,r29
.L6:
mov r29,r6
jarl _foo,lp
stsr PSW,r2
ori 0x80,r2,r2
ldsr r2,PSW
add 1,r29
cmp 10,r29
blt .L6
ld.w 4[sp],lp
ld.w 0[sp],r29
add 8,sp
jmp [lp]
Workaround
1) Use the “__asm()” statement for each in-line assembly instruction.
2) Insert an empty statement (semicolon (;)) at the end of the for loop compound statement.










