This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] S/390: Fix invalid left shift of negative integer value.


On 30 Oct 2015, at 15:27, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
> 
> On Fri, Oct 30, 2015 at 01:45:11PM +0100, Andreas Schwab wrote:
>> Dominik Vogt <vogt@linux.vnet.ibm.com> writes:
>>> -  return ((addr + (1 << align) - 1) & (-1 << align));
>>> +  return ((addr + (1 << align) - 1) & (~0u << align));
>> 
>> This is not the same if valueT is wider than int.
> 
> You're right.  I'll fix that and send a new patch in a different
> thread with fixes for all such shifts in binutils_gdb.

In FreeBSD, I fixed most of the warnings of this type by replacing
(-1 << x) with -(1 << x).  That is most often what was intended.

-Dimitry

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]