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

Andreas Schwab schwab@linux-m68k.org
Fri Oct 30 12:45:00 GMT 2015


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."



More information about the Binutils mailing list