https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116316
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
<source>:13:6: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]
13 | *(size_t *)(&(array_annotated->b)) = 10;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-fno-strict-aliasing fixes it.
You access `array_annotated->b` via size_t (which is most likely `unsigned
long`) and via int. Since long and int are distant types (and not signed
versions of each other) they don't alias.