-
Enhancement
-
Resolution: Unresolved
-
Not Prioritized
-
Code Generation Tools
-
CODEGEN-10710
-
C2000_22.6.0.LTS
-
default
The compiler should emit a warning that an integer conversion resulted in truncation when assigning an integer constant to a bit-field that is too small to hold the integer value. The compiler does not emit a warning when the declared type of the bit-field is big enough to hold the integer value, even though the actual bit-field might be too small to represent the value.
#include <stdint.h> struct { uint32_t hi:16; uint32_t lo:16; } s; void foo() { uint16_t l = 0x10000U; s.lo = 0x10000U; /* should get the same warning, but doesn't */ }