Re: [PATCH] Fix PR78305

2016-11-16 Thread Richard Biener
On November 16, 2016 5:22:17 PM GMT+01:00, Marc Glisse wrote: >On Wed, 16 Nov 2016, Michael Matz wrote: > >> Hi, >> >> On Wed, 16 Nov 2016, Marc Glisse wrote: >> > The first sentence about ORing the sign bit sounds strange (except >for a > sign-magnitude

Re: [PATCH] Fix PR78305

2016-11-16 Thread Marc Glisse
On Wed, 16 Nov 2016, Michael Matz wrote: Hi, On Wed, 16 Nov 2016, Marc Glisse wrote: The first sentence about ORing the sign bit sounds strange (except for a sign-magnitude representation). With 2's complement, INT_MIN is -2^31, the divisors are the 2^k and -(2^k). -2 * 2^30 yields INT_MIN,

Re: [PATCH] Fix PR78305

2016-11-16 Thread Michael Matz
Hi, On Wed, 16 Nov 2016, Michael Matz wrote: > > Looks good to me, thanks. > > An integer X is a power of two if and only if > X & -X == 0 (&& X != 0 if you want to exclude zero) Nonsense. It's X & -X == X (or X & (X-1) == 0) of course, and doesn't handle negative numbers. Still, no

Re: [PATCH] Fix PR78305

2016-11-16 Thread Michael Matz
Hi, On Wed, 16 Nov 2016, Marc Glisse wrote: > > > The first sentence about ORing the sign bit sounds strange (except for a > > > sign-magnitude representation). With 2's complement, INT_MIN is -2^31, the > > > divisors are the 2^k and -(2^k). -2 * 2^30 yields INT_MIN, but your test > > > misses

Re: [PATCH] Fix PR78305

2016-11-16 Thread Marc Glisse
On Wed, 16 Nov 2016, Richard Biener wrote: On Wed, 16 Nov 2016, Marc Glisse wrote: On Wed, 16 Nov 2016, Richard Biener wrote: On Wed, 16 Nov 2016, Marc Glisse wrote: On Wed, 16 Nov 2016, Richard Biener wrote: I am testing the following to avoid undefined behavior when negating a

Re: [PATCH] Fix PR78305

2016-11-16 Thread Richard Biener
On Wed, 16 Nov 2016, Marc Glisse wrote: > On Wed, 16 Nov 2016, Richard Biener wrote: > > > On Wed, 16 Nov 2016, Marc Glisse wrote: > > > > > On Wed, 16 Nov 2016, Richard Biener wrote: > > > > > > > I am testing the following to avoid undefined behavior when negating > > > > a multiplication

Re: [PATCH] Fix PR78305

2016-11-16 Thread Marc Glisse
On Wed, 16 Nov 2016, Richard Biener wrote: On Wed, 16 Nov 2016, Marc Glisse wrote: On Wed, 16 Nov 2016, Richard Biener wrote: I am testing the following to avoid undefined behavior when negating a multiplication (basically extending a previous fix to properly handle negative power of two).

Re: [PATCH] Fix PR78305

2016-11-16 Thread Richard Biener
On Wed, 16 Nov 2016, Marc Glisse wrote: > On Wed, 16 Nov 2016, Richard Biener wrote: > > > I am testing the following to avoid undefined behavior when negating > > a multiplication (basically extending a previous fix to properly handle > > negative power of two). > > > > Bootstrap / regtest

Re: [PATCH] Fix PR78305

2016-11-16 Thread Marc Glisse
On Wed, 16 Nov 2016, Richard Biener wrote: I am testing the following to avoid undefined behavior when negating a multiplication (basically extending a previous fix to properly handle negative power of two). Bootstrap / regtest running on x86_64-unknown-linux-gnu. Richard. 2016-11-16

[PATCH] Fix PR78305

2016-11-16 Thread Richard Biener
I am testing the following to avoid undefined behavior when negating a multiplication (basically extending a previous fix to properly handle negative power of two). Bootstrap / regtest running on x86_64-unknown-linux-gnu. Richard. 2016-11-16 Richard Biener PR