This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Incomplete patch to fix build with top-of-tree GCC
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>, Joseph Myers <joseph at codesourcery dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 18 May 2015 13:15:40 -0700
- Subject: Re: Incomplete patch to fix build with top-of-tree GCC
- Authentication-results: sourceware.org; auth=none
- References: <1431708170 dot 16668 dot 8 dot camel at ubuntu-sellcey> <alpine dot DEB dot 2 dot 10 dot 1505151645070 dot 21212 at digraph dot polyomino dot org dot uk> <55565718 dot 6070107 at cs dot ucla dot edu> <5556C3E4 dot 1080108 at redhat dot com>
- Reply-to: <sellcey at imgtec dot com>
On Sat, 2015-05-16 at 00:13 -0400, Carlos O'Donell wrote:
> On 05/15/2015 04:29 PM, Paul Eggert wrote:
> > On 05/15/2015 09:47 AM, Joseph Myers wrote:
> >> The first question is:*is* it OK to ignore the warnings?
> > I looked just at the first hunk of the patch, and it appears to me
> > that it's not OK to ignore its warnings. The type punning in the
> > first hunk appears to violate the C standard; although I don't know
> > whether GCC is generating "incorrect" code as a result, instead of
> > silencing the warning how about fixing the code so that it doesn't
> > have those funky casts? Something like the attached (untested) patch,
> > say.
>
> Yes please.
>
> We should be fixing this everywhere we see obvious C strict-aliasing violations.
>
> Your changes are mechanical and look good to me.
>
> Cheers,
> Carlos.
> > #ifdef SALEN
> > - ss.__ss_len = len;
> > + ss.generic.__ss_len = len;
> > #endif
> > - ss.ss_family = family;
> > + ss.generic.ss_family = family;
It looks like this last line should be 'sa_family', not 'ss_family'. If
I change that, there are still two lines that give an error:
rcmd.c: In function 'iruserok_af':
rcmd.c:618:24: error: dereferencing type-punned pointer will break
strict-aliasing rules [-Werror=strict-aliasing]
memcpy (&(((struct sockaddr_in *)&ra)->sin_addr), raddr,
^
rcmd.c:624:24: error: dereferencing type-punned pointer will break
strict-aliasing rules [-Werror=strict-aliasing]
memcpy (&(((struct sockaddr_in6 *)&ra)->sin6_addr), raddr,
Do we need to create another anonymous union in iruserok_af to fix
these?
Steve Ellcey
sellcey@imgtec.com