Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.9.0
-
None
Description
In Javascript, a|0 should result in a truncated to an integer. The JIT version of V4 handles this properly, while the interpreter returns the value unchanged, resulting in incorrect code.
In trivial tests, the whole computation seems to get optimized out, so slightly more complex code is needed to reproduce this bug. Example:
import QtQml 2.0 QtObject { Component.onCompleted: { var a=1 var b=10 for(var i=0;i<5;i++) { var c =(a+b)/2|0; print(c) b=c } } }
When running with JIT, this correctly prints 5,3,2,1,1.
With QV4_FORCE_INTERPRETER, I get 5.5, 3.25, 2.125, and so on
Attachments
For Gerrit Dashboard: QTBUG-68640 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
231510,4 | Fix truncating of doubles to integers | 5.9 | qt/qtdeclarative | Status: MERGED | +2 | 0 |