[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: [MAJOR BUG] g++ 2.95.x generates invalid code for KDE 3.3.0
From: Thiago Macieira <thiago.macieira () kdemail ! net>
Date: 2004-09-19 13:24:59
Message-ID: 200409191025.07652.thiago.macieira () kdemail ! net
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
Leo Savernik wrote:
>No, it's the genuine gcc-2.95. I discovered the bug, and Thiago confirmed
> it. So it *is* serious.
After some more testing, the bug happens in the following cases:
- the virtual base is not the first ancestor
- a constructor for one of the classes inheriting the virtual base calls one
function which in turn calls an overridden virtual function
I.e., during KBufferedSocket creation, the KStreamSocket constructor calls
KSocketBase::setBlocking, which in turn calls the virtual setSocketOptions,
which is overriden in KClientSocketBase.
At that moment, the object is still a KStreamSocket, with the virtual tables
being provided by KStreamSocket (both for the main object and the virtual
base). When one overriden virtual function is called from a non-direct
base, it goes through a thunk stub to adjust the "this" pointer. Problem
is: that thunk is also provided by KStreamSocket -- which is wrong, because
the real object is not a KStreamSocket, but a KBufferedSocket
With g++ 3.3/3.4, the virtual tables are provided by the most-derived
constructor (i.e., KBufferedSocket) -- the so-called "construction virtual
table". This solves the problem.
So, I can come up with a quick-fix: remove the "setBlocking(false)" from the
constructors. This should, *AFAICS*, workaround the problem. But also note
that this introduces a behaviour change because KStreamSocket's will be
blocking by default now. KBufferedSocket may in some occasions report that
it is blocking when in fact it is not.
Patch is attached. Leo: please test it.
And I SERIOUSLY recommend that for KDE 4, gcc 2.95 is no longer supported.
--
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
["kstreamsocket-gcc2.95.patch" (text/x-diff)]
Index: kbufferedsocket.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/network/kbufferedsocket.cpp,v
retrieving revision 1.8
diff -u -3 -p -r1.8 kbufferedsocket.cpp
--- kbufferedsocket.cpp 26 Jul 2004 22:58:03 -0000 1.8
+++ kbufferedsocket.cpp 19 Sep 2004 13:22:05 -0000
@@ -52,7 +52,6 @@ KBufferedSocket::KBufferedSocket(const Q
: KStreamSocket(host, service, parent, name),
d(new KBufferedSocketPrivate)
{
- setBlocking(false);
setInputBuffering(true);
setOutputBuffering(true);
}
Index: kstreamsocket.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/network/kstreamsocket.cpp,v
retrieving revision 1.12
diff -u -3 -p -r1.12 kstreamsocket.cpp
--- kstreamsocket.cpp 23 Jun 2004 22:40:51 -0000 1.12
+++ kstreamsocket.cpp 19 Sep 2004 13:22:05 -0000
@@ -57,7 +57,6 @@ KStreamSocket::KStreamSocket(const QStri
peerResolver().setServiceName(service);
peerResolver().setFamily(KResolver::KnownFamily);
localResolver().setFamily(KResolver::KnownFamily);
- setBlocking(false);
QObject::connect(&d->timer, SIGNAL(timeout()), this, SLOT(timeoutSlot()));
}
[Attachment #6 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic