Overflow fix (was Problems with trampoline.S with 64 bit binutils)
Alan Modra
alan@SPRI.Levels.UniSA.Edu.Au
Wed Jul 28 15:57:00 GMT 1999
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??
More information about the Binutils
mailing list