[Development] integer bug in Qt4.8.x
Thomas Senyk
thomas.senyk at pelagicore.com
Wed Mar 6 11:38:15 CET 2013
Hi,
I think I stumbled over a bug in Qt4.8.x - QtDeclarative, but I wanted to
asked for opinions first.
First of all: This is not happening in Qt5 (neither QtQuick2.0 nor QtQuick
1.1)
This seems to only happen on ARM... at least I couldn't reproduce on any x86
machine I tried.
The ARM system I tested on:
- imx6
- yocto based rootfs, sysroot and toolchain
- Qt5 built using mkspecs/devices/linux-imx6-g++ (not haven the bug)
- Qt4 built with my own mkspec based on the Qt5 device-mkspec
- Qt4/5 source-code from git with a most recent checkout
The bug:
It's about imprecise 'int' in QtQuick1.1 / JS (only Qt4!)
A code snipped triggering it would be:
property int ex: 0
Component.onCompleted:
{
var tmp;
var c = 1;
for ( tmp = ex + 1; /*forever*/; tmp++ )
{
if ( tmp !== ( ex + 1 ) )
{
console.log( "error: " + tmp + " != " + ex + " + 1" );
}
c = c+1;
if ( c > 100000 )
{
console.log( tmp );
c = 1;
}
ex = tmp;
}
}
The log looks like:
...
8200000
8300000
error: 8388610 != 8388610 + 1
error: 8388612 != 8388612 + 1
error: 8388614 != 8388614 + 1
error: 8388616 != 8388616 + 1
...
where 8388610 == 0x800002
For me it looks a little bit like some sort of floating-point accuracy
problems ... or a casting-error ... ?
Greets
Thomas
More information about the Development
mailing list