Commit d9a9c5a7 by Richard Kenner

(convert_to_integer): When we want to return zero, be sure we honor

any side-effects in our operand.

From-SVN: r4255
parent 3dc4a939
...@@ -199,11 +199,22 @@ convert_to_integer (type, expr) ...@@ -199,11 +199,22 @@ convert_to_integer (type, expr)
/* In this case, shifting is like multiplication. */ /* In this case, shifting is like multiplication. */
goto trunc1; goto trunc1;
else else
/* If it is >= that width, result is zero. {
Handling this with trunc1 would give the wrong result: /* If it is >= that width, result is zero.
(int) ((long long) a << 32) is well defined (as 0) Handling this with trunc1 would give the wrong result:
but (int) a << 32 is undefined and would get a warning. */ (int) ((long long) a << 32) is well defined (as 0)
return convert_to_integer (type, integer_zero_node); but (int) a << 32 is undefined and would get a
warning. */
tree t = convert_to_integer (type, integer_zero_node);
/* If the original expression had side-effects, we must
preserve it. */
if (TREE_SIDE_EFFECTS (expr))
return build (COMPOUND_EXPR, type, expr, t);
else
return t;
}
} }
break; break;
......
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