Another GLIBC build error with GCC6

Paul Eggert eggert@cs.ucla.edu
Wed Jul 22 05:56:00 GMT 2015


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.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Port-the-0x7efe.feff-pattern-to-GCC-6.patch
Type: text/x-diff
Size: 4033 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150722/dcb104fb/attachment.bin>


More information about the Libc-alpha mailing list