Technical information
Operating Precautions for CPDW9X/NT-CDR-V85X, Y-GHS-MULTI-V800
TM
Customer Notification r20tu0003ed1812 38
No. a29
Wrong optimization for "Common-subexpr elimination”
Version Information
V3.5.1
Details
The compiler generates incorrect accesses to a volatile object. The problem only arises when the
set1 / clr1 instructions are used.
Example: test.c:
typedef struct Outputs_T {
unsigned char High:1 ;
unsigned char Low:1 ; } Outputs_T;
struct st_P3
{ unsigned int P30_b :1;
unsigned int P31_b :1;
unsigned int P32_b :1;
unsigned int P33_b :1;
unsigned int P34_b :1;
unsigned int P35_b :1;
unsigned int P36_b :1;
unsigned int P37_b :1;
unsigned int P38_b :1;
unsigned int P39_b :1;};
struct st_P5
{ unsigned int P50_b :1;
unsigned int P51_b :1;
unsigned int P52_b :1;
unsigned int P53_b :1;
unsigned int P54_b :1;
unsigned int P55_b :1;};
struct st_SFR
{ struct st_P3 P3;
struct st_P5 P5;};
volatile struct st_SFR REG;
void Output(Outputs_T APOut)
{
REG.P3.P39_b =3D APOut.High;
REG.P5.P50_b =3D APOut.Low;
}
void main(void)
{
Outputs_T a;
while(1) { Output(a); }
}










