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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Pedro Alves from comment #8)
> I see it the same as:
> 
>  int *ip = &ap->k;
>  ((struct b *)ip)->j;

That is certainly not fine from aliasing perspective, aliasing is not just
about the type of the field you access, but the whole access path, so if you
use ((struct b *)ip)->j then ip should point to an object with effective type
of struct b.
But, I'm afraid we can't warn about this for -Wstrict-aliasing=3, because that
would lead to too many false positives.

Reply via email to