I have this struct/union, to have a bitwise access in C99 codebase (not C++)
typedef union { struct { uint32_t a:1; uint32_t b:1; uint32_t c:1; uint32_t d:29; }; uint32_t u32; } MyStruct; MyStruct m;
When I do
m.a = m.b = m.c = 0;
cppcheck gives "Overlapping red/write of union is undefined behavior". Not sure if this is a real problem or a false positive.
Can someone give an advise?
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11013
Log in to post a comment.
I have this struct/union, to have a bitwise access in C99 codebase (not C++)
When I do
cppcheck gives "Overlapping red/write of union is undefined behavior".
Not sure if this is a real problem or a false positive.
Can someone give an advise?
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11013