Re: PR66311: Fix extension in mpz->wide_int conversions

2015-10-16 Thread Mike Stump
On Aug 5, 2015, at 7:14 AM, Richard Sandiford wrote: > wi::from_mpz reads the absolute value of the mpz and then negates the > result if the mpz is negative. When the top bit of the most-significant > HOST_WIDE_INT in the absolute value is set, we implicitly sign- > rather than zero-extend it to

Re: PR66311: Fix extension in mpz->wide_int conversions

2015-08-05 Thread Richard Biener
On Wed, Aug 5, 2015 at 4:14 PM, Richard Sandiford wrote: > wi::from_mpz reads the absolute value of the mpz and then negates the > result if the mpz is negative. When the top bit of the most-significant > HOST_WIDE_INT in the absolute value is set, we implicitly sign- > rather than zero-extend it

PR66311: Fix extension in mpz->wide_int conversions

2015-08-05 Thread Richard Sandiford
wi::from_mpz reads the absolute value of the mpz and then negates the result if the mpz is negative. When the top bit of the most-significant HOST_WIDE_INT in the absolute value is set, we implicitly sign- rather than zero-extend it to full precision. For example, 1 << 63 gets mangled to (1 << pr