This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] S/390: Fix invalid left shift of negative integer value.
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: Dominik Vogt <vogt at linux dot vnet dot ibm dot com>
- Cc: binutils at sourceware dot org, Andreas Arnez <arnez at linux dot vnet dot ibm dot com>, Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Date: Fri, 30 Oct 2015 13:45:11 +0100
- Subject: Re: [PATCH] S/390: Fix invalid left shift of negative integer value.
- Authentication-results: sourceware.org; auth=none
- References: <20151030120803 dot GA27648 at linux dot vnet dot ibm dot com>
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."