This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Another GLIBC build error with GCC6
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: Roland McGrath <roland at hack dot frob dot com>, Jeff Law <law at redhat dot com>, "GNU C Library" <libc-alpha at sourceware dot org>
- Date: Tue, 18 Aug 2015 09:12:21 -0700
- Subject: Re: Another GLIBC build error with GCC6
- Authentication-results: sourceware.org; auth=none
- References: <1437496279 dot 19674 dot 126 dot camel at ubuntu-sellcey> <1437507995 dot 19674 dot 136 dot camel at ubuntu-sellcey> <55AEA71B dot 2020405 at redhat dot com> <1437509796 dot 19674 dot 138 dot camel at ubuntu-sellcey> <55AEB7FF dot 1000405 at redhat dot com> <1437518197 dot 19674 dot 152 dot camel at ubuntu-sellcey> <20150721224637 dot 1E0102C3B32 at topped-with-meat dot com> <55AF30A1 dot 2030402 at cs dot ucla dot edu>
- Reply-to: <sellcey at imgtec dot com>
On Tue, 2015-07-21 at 22:56 -0700, Paul Eggert wrote:
> Roland McGrath wrote:
> > the left shift doesn't even lose any bits, because the high
> > bit is already zero (and it's a constant, so the compiler knows that).
>
> But it does lose a bit. It loses a zero bit, which can't be recovered the way
> that a non-overflowing signed left shift is recovered by shifting right the same
> amount.
>
> > that's the whole point of the thing: to sign-extend the 31-bit value
> > to 32 bits. I don't think it should complain about 0x7fffffff << 1.
>
> Such complaints are useful for compilers that take advantage of C's overflow
> rules to generate efficient-but-weird code when you violate the rules (something
> that describes GCC more and more nowadays...).
>
> Anyway, if I understand this one correctly it should be easy enough to fix
> portably. Something like the attached patch, say. (I haven't tested it.)
Paul,
This patch looks good to me and works fine on MIPS, now that the GLIBC
trunk is unfrozen do you want to check it in? I would like to get GLIBC
building again with the latest GCC and this is one of the things that
needs fixing in order to get rid of the warnings.
Steve Ellcey
sellcey@imgtec.com