https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119070
--- Comment #7 from Taylor Hutt <taylor.hutt at broadcom dot com> --- (In reply to Andrew Pinski from comment #6) > You could do: > > struct_1 *v1 = &global_0.f_2_0; > asm("":"+r"(v1)); > unsigned char *v2 = (unsigned char *)v1; > > to hide from GCC that the address of v2 is related to a global variable. > And that should get rid of the warning too. > > But otherwise this is undefined code. Why not cast the pointer to uintptr_t at the point of the undefined behavior pointer arithmetic?