chakra-core / chakra-core/ChakraCore

incorrect result with unsigned right shift operator

Open
#6,822 1 comment 0 reactions 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

This poc will output different results in the JIT compiler.
```js
function test2(a) {
if ((a | 0) >>> 0 > (11569 | -29007) >>> 0)
return true;
else
return false;
}

for (var i = 0; i < 10; i++) {
print(test2(-1))
}
```
run with command in current master branch(`commit 41ad58a9eebf8d52a83424c8fccfaacdb14105ec`):
```
Build\VcBuild\bin\x64_debug\ch.exe test.js -bgjit- -mic:5 -off:simplejit
```
output:
```
true
true
true
true
true
false
false
false
false
false
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing test.js with the provided ChakraCore commit and command, including the JIT options, and compare the repeated results. Trace the unsigned right-shift expression through the JIT compiler; done means the test produces the correct consistent result across all iterations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, javascript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.