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.


Dominik Vogt <vogt@linux.vnet.ibm.com> writes:

> diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
> index e217e56..7434100 100644
> --- a/gas/config/tc-s390.c
> +++ b/gas/config/tc-s390.c
> @@ -2047,7 +2047,7 @@ md_section_align (asection *seg, valueT addr)
>  {
>    int align = bfd_get_section_alignment (stdoutput, seg);
>  
> -  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.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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