Qt World Summit: Register Today!

Getting ASSERT: "casted->type == SInt32Type" when bitwise ORing with 0 in Javascript

  • Using the new Qt 5.4. This issue did not happen in Qt 5.3.2.

    I have Javascript code that retrieves the integer part of a floating point by bitwise ORing with 0. I use QJSEngine to evaluate the code. When running a Debug build, I'm getting this assertion:
    "ASSERT: "casted->type == SInt32Type" in file compiler\qv4ssa.cpp, line 4065"

    Example code:
    QJSEngine engine;
    QString jsCode = "var n = 0.1; var test = (n*255) | 0;";
    QJSValue result = engine.evaluate( jsCode );

    I've noticed two things:

    1. This assertion only happens when there is a variable or function call involved. That is, the assertion does not happen if the operation is only with constants like: var test = (0.1 * 255) | 0;
    2. This assertion also only happens when ORing with 0. If I change code to OR with 1, assertion does not occur.

    Is this a bug?

  • I'm seeing this same issue also when using QtCanvas3D + latest three.js on Windows..

Log in to reply