On Mon, Jan 14, 2019 at 10:00:11AM -0800, H.J. Lu wrote: > On Mon, Jan 14, 2019 at 6:22 AM Jakub Jelinek <ja...@redhat.com> wrote: > > > > On Sun, Jan 13, 2019 at 06:54:05AM -0800, H.J. Lu wrote: > > > > What always matters is whether we take address of a packed structure > > > > field/non-static data member or whether we just read that field. > > > > The former should be warned about, the latter not. > > > > > > > > > > How about this patch? It checks if address is taken with NOP. > > > > I'd like to first understand the convert_p argument to > > warn_for_address_or_pointer_of_packed_member. > > > > To me it seems you want to emit two different warnings, perhaps one > > surpressed if the other one is emitted, but you actually from the start > > decide which of the two you are going to check for. That is just weird. > > convert_p is only for C.
Why? What is so special about C and (implicit?) casts where the rhs isn't ADDR_EXPR? Aren't all casts (explicit or implicit) from one pointer type to another pointer and satisfy the rules something that should be warned about if the conditions are met? Jakub