[MAJOR BUG] g++ 2.95.x generates invalid code for KDE 3.3.0
Thiago Macieira
thiago.macieira at kdemail.net
Fri Sep 17 20:44:12 BST 2004
Hello,
I hope I am not making a fool of myself, if this turns out to be something
else than I've determined.
But anyways, this is a serious problem.
The attached program is a simple test-case showing the problem. It mimics
the hierarchy leading to KNetwork::KStreamSocket and, thence, to
KNetwork::KBufferedSocket. The latter is being used already in Kopete code
as released with KDE 3.3.0, as well as Konversation.
As reported in bug #87548, Kopete crashes as it tries to connect. Valgrind
log shows the function KNetwork::KSocketBase::mutex() returns 0x10 instead
of the proper address for a QMutex. That can only happen if KSocketBase's d
pointer is NULL -- which again isn't possible since it is initialised in
KSocketBase's only constructor.
Suspecting compiler bug, I created the attached code that mimics the real
inheritance hierarchy (which is quite complex, including a virtual base).
The code crashes as well, with the exact same symptom as that reported in
bug #87548. What's more, g++ 3.3- and 3.4-compiled code does *not* crash. I
tracked the bug down to a pointer adjustment for 'this', as I had suspected
in the bug report.
After this lengthy explanation, here goes:
1) can anyone else confirm my conclusion (i.e., that it is a compiler bug)?
2) if not so, where's the error?
3) if so, what do we do now?
Kopete and Konversation, as released, do not work when compiled with g++
2.95.4. Current libkdecore therefore contains faulty code.
3.a) Is there a more updated version than g++ 2.95.4, which fixes the bug?
3.b) If not, Is there a way to modify the code so as not to trigger this g++
bug?
If this involves redesigning the hierarchy, it'll have to be inside
#if/#endif.
3.c) If not, we will have to drop compatibility for g++ 2.95.x a lot sooner
than expected.
--
Thiago Macieira - Registered Linux user #65028
thiago (AT) macieira (DOT) info
ICQ UIN: 1967141 PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: text/x-c++src
Size: 1437 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040917/da784f4c/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040917/da784f4c/attachment.sig>
More information about the kde-core-devel
mailing list