https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102937

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
That is the following is undefined:
char *a = NULL;
size_t &t = reinterpret_cast<size_t&>(a);
t = 0x8;
printf("%p\n", a);

GCC does give a warning in the above case too:

<source>: In function 'int main()':
<source>:69:39: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]
   69 | size_t &t = reinterpret_cast<size_t&>(a);
      |                                       ^

Reply via email to