This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/70143] [6 Regression] false strict-aliasing warning


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]