https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112409
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Frediano Ziglio from comment #5) > But the pointer "passes" through a "void*" conversion, so there should be no > aliasing. Or am I missing something? That's not how aliasing works. You can't just cast to void* to change the effective type of that struct and magically make it valid to read uint16_t values from it. > So what's the standard C way to avoid this (without using specific compiler > options) ? memcpy GCC will also allow you to use a union, but the union has to be visible in the code that performs the type punning.