[previous] 2124 [next] Integral promotion : signed bit-field promoted to signed int.
Arithmetic type - Integral promotion REFERENCE - ISO:C90-6.2.1.1 Characters and Integers

A bit-field of signed type is being converted to type signed int under the rules of integral promotion.

This type of conversion will occur whenever a signed bit-field is used as an operand to one of the following operators:

Unary + - ~
Multiplicative * / %
Additive + -
Bitwise Shift << >>
Relational < > <= >=
Equality == !=
Bitwise & | ^
Conditional ? : (2nd and 3rd operands)

For example:


/*PRQA S 2017,3131,3408,3447,3602,3621 ++*/

struct ST
{
    signed int sib3:3;
    signed int sib5:5;
};

extern struct ST   stx;

extern signed char sr;

extern void foo(void)
{
    sr = -stx.sib3;                            /* Message 2124 */
}


No MISRA-C:2004 Rules applicable to message 2124


QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents