This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CARM & bitfields in a structure : is this a bug ?

typedef struct
{
 int query_zone:4;
}statusrequest_t;

statusrequest_t state;

state.query_zone=8;

if ( state.query_zone==8)
 printf("The result matches n=%i n\r",state.query_zone);
else
 printf("This should not occur n=%i\n\r",state.query_zone);

CARM produces : This should not occur n=-8
RV produces : The result matches n=8

typedef struct
{
 short query_zone:4;
}statusrequest_t;


CARM produces : The result matches n=8
RV produces : This should not occur n=-8

typedef struct
{
 signed char query_zone:4;
}statusrequest_t;


CARM produces : The result matches n=8
RV produces : This should not occur n=-8

Why does the comparision fail when query_zone is an int bitfield ?
The RV compiler produces not the same result as CARM

0