[patch] MIPS/gas: load/store address overflow on binutils 2.14

Alan Modra amodra@bigpond.net.au
Fri Sep 12 14:11:00 GMT 2003


On Fri, Sep 12, 2003 at 03:37:22PM +0200, Maciej W. Rozycki wrote:
>     ep->X_add_number = (ep->X_add_number << 32) >> 32;

If I recall correctly, a right shift of a negative signed integer is
"implementation defined" according to the C standard.  You are also
assuming that X_add_number is exactly 64 bit.  Sign extension is
better done with

  x = ((x & 0xffffffff) ^ 0x80000000) - 0x80000000;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list