Status: New
Owner: ----

New issue 3151 by [email protected]: (MinInt / 2^n) | 0 gives result with wrong sign
http://code.google.com/p/v8/issues/detail?id=3151

Simple test case:

===
function div_by_two(x) {
  return (x / 2) | 0;
}

div_by_two(42);
%OptimizeFunctionOnNextCall(div_by_two);
div_by_two(42);

assertEquals(((-2147483648) / 2) | 0, div_by_two(-2147483648));
===

This gives +1073741824 on at least arm and ia32, when it should be negative.

I think it's caused by lithium codegen negating -2^31, resulting in -2^31, then using arithmetic shift right to do the power-of-two division. This result is negated again to give the positive, wrong answer.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to