https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70143
--- Comment #8 from Pedro Alves <palves at redhat dot com> ---
> Note that we then also don't warn for
(...)
> struct a { int i; int k; };
> return ((struct b *)&ap->k)->j;
(...)
> then either
I see it the same as:
int *ip = &ap->k;
((struct b *)ip)->j;
Fine from type alias perspective, but undefined for other reasons.
> Doing this kind of warnings strictly based on alias
> sets only is going to be "broken"
Agreed -- a warning for this case should probably be based on
layout / determining that k is not the initial field of struct a,
and thus this is undefined behavior.