This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Workaround `shift count >= width of type'
- From: Tristan Gingold <gingold at adacore dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 28 May 2010 09:16:31 +0200
- Subject: Re: [patch] Workaround `shift count >= width of type'
- References: <20100527184027.GA19034@host0.dyn.jankratochvil.net>
On May 27, 2010, at 8:40 PM, Jan Kratochvil wrote:
> Hi,
>
> on i686 host (tested FSF GCC 4.4, 4.5 and HEAD with -m32) it errors out during
> --enable-targets=all on:
> vms-misc.c:590: error: right shift count >= width of type
> vms-misc.c:591: error: right shift count >= width of type
>
> It is in fact a GCC bug but even if it would get fixed these GCC versions are
> too widespread to ignore.
>
> OK to check-in?
Yes, please.
Tristan.
> Thanks,
> Jan
>
>
> bfd/
> 2010-05-27 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Workaround GCC PR middle-end/4210.
> * vms-misc.c (vms_time_t_to_vms_time): Use ternary operator for val[2]
> and val[3].
>
> --- a/bfd/vms-misc.c
> +++ b/bfd/vms-misc.c
> @@ -585,16 +585,8 @@ vms_time_t_to_vms_time (time_t ut, unsigned int *hi, unsigned int *lo)
> /* Put into val. */
> val[0] = ut & 0xffff;
> val[1] = (ut >> 16) & 0xffff;
> - if (sizeof (ut) > 4)
> - {
> - val[2] = (ut >> 32) & 0xffff;
> - val[3] = (ut >> 48) & 0xffff;
> - }
> - else
> - {
> - val[2] = 0;
> - val[3] = 0;
> - }
> + val[2] = sizeof (ut) > 4 ? (ut >> 32) & 0xffff : 0;
> + val[3] = sizeof (ut) > 4 ? (ut >> 48) & 0xffff : 0;
>
> /* Add offset. */
> tmp[0] = VMS_TIME_OFFSET & 0xffff;