Commit 2bd21a02 by Andreas Schwab Committed by Jeff Law

fold-const.c (fold_truthop): Make the field reference unsigned when converting a…

fold-const.c (fold_truthop): Make the field reference unsigned when converting a single bit compare.

h
        * fold-const.c (fold_truthop): Make the field reference unsigned
        when converting a single bit compare.

From-SVN: r27202
parent 8eba681f
...@@ -3806,11 +3806,10 @@ fold_truthop (code, truth_type, lhs, rhs) ...@@ -3806,11 +3806,10 @@ fold_truthop (code, truth_type, lhs, rhs)
{ {
if (l_const && integer_zerop (l_const) && integer_pow2p (ll_mask)) if (l_const && integer_zerop (l_const) && integer_pow2p (ll_mask))
{ {
/* Do not sign extend the constant here. The left operand /* Make the left operand unsigned, since we are only interested
is either always unsigned or there is a BIT_AND_EXPR that in the value of one bit. Otherwise we are doing the wrong
masks out the extension bits. */ thing below. */
if (! (ll_unsignedp || ll_and_mask != 0)) ll_unsignedp = 1;
abort ();
l_const = ll_mask; l_const = ll_mask;
} }
else else
...@@ -3822,8 +3821,7 @@ fold_truthop (code, truth_type, lhs, rhs) ...@@ -3822,8 +3821,7 @@ fold_truthop (code, truth_type, lhs, rhs)
{ {
if (r_const && integer_zerop (r_const) && integer_pow2p (rl_mask)) if (r_const && integer_zerop (r_const) && integer_pow2p (rl_mask))
{ {
if (! (rl_unsignedp || rl_and_mask != 0)) rl_unsignedp = 1;
abort ();
r_const = rl_mask; r_const = rl_mask;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment