[pushed] Fix struct sockaddr/sockaddr_in/sockaddr_un strict aliasing violations

Eli Zaretskii eliz@gnu.org
Mon Mar 9 16:04:00 GMT 2015


> Date: Mon, 09 Mar 2015 11:38:53 +0000
> From: Pedro Alves <palves@redhat.com>
> CC: gdb-patches@sourceware.org
> 
> On 03/09/2015 11:10 AM, Pedro Alves wrote:
> 
> > With all that said, I'm having second thoughts on this ...  Per
> > 6.3.2.3 ("A pointer to an object or incomplete type may be converted to
> > a pointer to a different object or incomplete type"), as long as we don't
> > actually access the fields of sockaddr through the "struct sockaddr *" pointer,
> > then the cast should be OK.  In the bind/accept cast, it should be the
> > internals of those functions that need the union trick.  Gosh, what a mess.
> > 
> > So I'll revert the union patch, and apply the original one that added
> > the missing cast to tracepoint.c...
> 
> Done.  Sorry for the noise...

I should be sorry first ;-)



More information about the Gdb-patches mailing list