[Development] QImage miscompilation with gcc

Martin Koller kollix at aon.at
Wed Feb 4 11:11:47 CET 2015


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 ?

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\                        - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.lillehus.at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal.diff
Type: text/x-patch
Size: 969 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150204/83fe597c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.diff
Type: text/x-patch
Size: 519 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150204/83fe597c/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: splash.cxx
Type: text/x-c++src
Size: 224 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150204/83fe597c/attachment.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: splash.pro
Type: application/vnd.nokia.qt.qmakeprofile
Size: 53 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150204/83fe597c/attachment-0002.bin>


More information about the Development mailing list