[gold commit] PR gold/19577: Fix compile errors about shift counts too large

Cary Coutant ccoutant@gmail.com
Sun Feb 7 02:18:00 GMT 2016


In order to get around the optimizer and newer compiler warnings
about shift counts, the overflow checking code had resorted to
some messy shifting, and with the never-before-seen instantiations
of the template functions, we were still running afoul of the
compiler checks.

This patch replaces those messy shift sequences with a simple
class template that provides the min and max limits for any
bit size up to 64, with a specialization for 64 that prevents
the compiler from complaining.

2016-02-06  Cary Coutant  <ccoutant@gmail.com>

gold/
        PR gold/19577
        * reloc.h (Limits): New class.
        (Bits::has_overflow32): Use min/max values from Limits.
        (Bits::has_unsigned_overflow32): Likewise.
        (Bits::has_signed_unsigned_overflow32): Likewise.
        (Bits::has_overflow): Likewise.
        (Bits::has_unsigned_overflow): Likewise.
        (Bits::has_signed_unsigned_overflow64): Likewise.



More information about the Binutils mailing list