This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Overflow fix (was Problems with trampoline.S with 64 bit binutils)
Date: Thu, 29 Jul 1999 08:27:32 +0930 (CST)
From: Alan Modra <alan@SPRI.Levels.UniSA.Edu.Au>
On 28 Jul 1999, Ian Lance Taylor wrote:
> Date: Wed, 28 Jul 1999 18:39:18 +0930 (CST)
> From: Alan Modra <alan@SPRI.Levels.UniSA.Edu.Au>
>
> Is it OK for me to check this one in, Ian? It's almost in the "obvious
> fix" category...
>
> Almost.
>
> > + mask <<= size * 8 - (fixP->fx_signed ? 1 : 0);
>
> If size is 4 and fixP->fx_signed is not set, then this will do a left
> shift by 32. If mask is itself 32 bits, then this is not defined by
> ANSI C. There are in fact compilers which will turn this into a
> no-op: they generate a shift by 32 instruction, which is masked into a
> shift by 0 instruction.
>
> That's why I had the two shifts in the old code, and I think we need
> to keep that.
size == 4 => sizeof (mask) > 4. Surely ANSI C doesn't restrict shift
counts of 64 bit quantities to 32??
Whoops, sorry, I totally missed the initial if condition. Yes, please
check in this patch.
Ian