https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107274
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |24639
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
No, the issue is that you are accessing 8 bytes on the read and thus the
padding you access that way is not initialized. Use *(unsigned int)b and the
diagnostic goes away.
[internally GCC doesn't consider an indirect load of size 8 ever aliasing
a store to a 4 byte object - otherwise we wouldn't diagnose a partial
uninit value -- like
void
example(unsigned long val)
{
char b[8];
b[0] = val;
b[1] = val >> 8;
b[2] = val >> 16;
b[3] = val >> 24;
val = *(unsigned long *)b;
}
which isn't diagnosed]
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues