Message ID | 87li14h6nw.fsf@talisman.default |
---|---|
State | New |
Headers | show |
Ping. Richard Sandiford <rdsandiford@googlemail.com> writes: > As discussed on gcc@, integer_onep is supposed to return false for > a nonzero 1-bit value if the type is signed. > > Tested on x86_64-linux-gnu and powerpc64-linux-gnu. OK to install? > > Thanks, > Richard > > > Index: gcc/tree.c > =================================================================== > --- gcc/tree.c 2013-10-29 19:19:27.623468618 +0000 > +++ gcc/tree.c 2013-11-02 17:25:06.499657501 +0000 > @@ -2092,7 +2092,7 @@ integer_onep (const_tree expr) > switch (TREE_CODE (expr)) > { > case INTEGER_CST: > - return wi::eq_p (expr, 1); > + return wi::eq_p (wi::to_widest (expr), 1); > case COMPLEX_CST: > return (integer_onep (TREE_REALPART (expr)) > && integer_zerop (TREE_IMAGPART (expr)));
On Wed, Nov 6, 2013 at 11:31 PM, Richard Sandiford <rdsandiford@googlemail.com> wrote: > Ping. Ok. Thanks, Richard. > Richard Sandiford <rdsandiford@googlemail.com> writes: >> As discussed on gcc@, integer_onep is supposed to return false for >> a nonzero 1-bit value if the type is signed. >> >> Tested on x86_64-linux-gnu and powerpc64-linux-gnu. OK to install? >> >> Thanks, >> Richard >> >> >> Index: gcc/tree.c >> =================================================================== >> --- gcc/tree.c 2013-10-29 19:19:27.623468618 +0000 >> +++ gcc/tree.c 2013-11-02 17:25:06.499657501 +0000 >> @@ -2092,7 +2092,7 @@ integer_onep (const_tree expr) >> switch (TREE_CODE (expr)) >> { >> case INTEGER_CST: >> - return wi::eq_p (expr, 1); >> + return wi::eq_p (wi::to_widest (expr), 1); >> case COMPLEX_CST: >> return (integer_onep (TREE_REALPART (expr)) >> && integer_zerop (TREE_IMAGPART (expr)));
Index: gcc/tree.c =================================================================== --- gcc/tree.c 2013-10-29 19:19:27.623468618 +0000 +++ gcc/tree.c 2013-11-02 17:25:06.499657501 +0000 @@ -2092,7 +2092,7 @@ integer_onep (const_tree expr) switch (TREE_CODE (expr)) { case INTEGER_CST: - return wi::eq_p (expr, 1); + return wi::eq_p (wi::to_widest (expr), 1); case COMPLEX_CST: return (integer_onep (TREE_REALPART (expr)) && integer_zerop (TREE_IMAGPART (expr)));