[Development] QImage miscompilation with gcc

Konstantin Tokarev annulen at yandex.ru
Wed Feb 4 11:39:57 CET 2015



04.02.2015, 13:12, "Martin Koller" <kollix at aon.at>:
> I've found a very strange (and serious) miscompilation of QImage with g++
>
> In qimage.cpp there is a simple line (3584 in Qt-5.3.2):
>         d->paintEngine = paintEngine ? paintEngine : new QRasterPaintEngine(paintDevice);
> which results in 0(!). The return value of this method QImage::paintEngine() is then 0 -
> which should never happen.
>
> I can reproduce with a slightly modified "minimal" platform plugin, and only if it has
> a second QImage member, which gets its mImage member assigned.
>
> I have created a very small reproducible example program and I verified that this only
> happens when compiling QtGui with gcc (4.8.3 or 4.9.0), but it does not happen with clang (3.5.0).
>
> All tests are done on x86/64bit Linux (openSuse 13.2) with a self-compiled Qt5.3.2 (with a namespace, in debug mode).
> I also see the problem compiled with gcc-4.8.2 in release mode compiled on a CentOS-7
>
> Testprogram/diff attached.
> Simply run with ./splash -platform minimal and in case of the bug it prints:
> created new QImage paint engine 0x0
> returning QImage paint engine 0x0
> QWidget::paintEngine: Should no longer be called
> QPainter::begin: Paint device returned engine == 0, type: 1
> QPainter::setPen: Painter not active
>
> Can anyone please tell me if you can reproduce this ?
> Is this really a gcc bug ?
> Shall I create a gcc bug report with this example/description or is this much too large for
> a testcase ?

You might want try to reproduce it with different compiler (e.g., different version of gcc, or clang). If it reprocudes, folow these instructions:

https://gcc.gnu.org/wiki/A_guide_to_testcase_reduction

-- 
Regards,
Konstantin



More information about the Development mailing list