Technical information

Operating Precautions for CPDW9X/NT-CDR-V85X, Y-GHS-MULTI-V800
TM
Customer Notification r20tu0003ed1812 88
No. a80
Wrong access order to ‘volatile’ arrays
Version Information
V4.0.5, V4.0.7, V4.0.7a, V4.2.3, V4.2.4
Details:
The compiler ‘forgets’ the volatile attribute of certain objects. The main reason for this is the
pipeline scheduler as the primary source responsible for changing the order of instructions.
Example:
volatile unsigned char data[20];
void testfunc(void)
{
data[2] &= ~0x20;
data[3] &= ~0x20;
data[10] |= 0x20;
data[11] |= 0x20;
data[10] |= 0x40;
data[11] |= 0x40;
}
The generated order of accessing the array is different to that specified in the source module.
--5: data[2] &= ~0x20;
mov _data,r2
set1 5,11[r2]
--11: data[10] |= 0x40;
set1 6,11[r2]
ld.bu 2[r2],r17
set1 5,10[r2]
Command Line
ccv850e c cpu=v850e -Ospace test.c
Workaround
1) Please use newer compilers V4.2.4-N1 or later.
2) Use option Onopipeline, if compiler update is not possible