Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT cygwin DOT com Delivered-To: mailing list cygwin-developers AT cygwin DOT com Subject: Re: Many pthread failures in the test suite, one setgroup failure From: Robert Collins To: egor duda In-Reply-To: <44642850720.20020928223759@logos-m.ru> References: <20020925141653 DOT GA6134 AT redhat DOT com> <1033139976 DOT 22908 DOT 333 DOT camel AT lifelesswks> <163544913434 DOT 20020927192540 AT logos-m DOT ru> <1033140780 DOT 9593 DOT 0 DOT camel AT lifelesswks> <44642850720 DOT 20020928223759 AT logos-m DOT ru> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-bXM/NCYZY3UtTkmXmadN" Date: 29 Sep 2002 09:07:34 +1000 Message-Id: <1033254454.4375.48.camel@lifelesswks> Mime-Version: 1.0 --=-bXM/NCYZY3UtTkmXmadN Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2002-09-29 at 04:37, egor duda wrote: > I guess i know why it works for you. Hint: Try gcc 3.x to build > cygwin1.dll. Me and Chris, are using it, obviously, while you're > probably using 2.95, right? Yes, I've been holding off upgrading until gcc 3.x is the default for cygwin, at which time I will migrate the setup sources to 3.x. =20 > class verifyable_object contains no virtual functions, hence no > pointer to VMT in it. This means that compiler assumes that magic > member is placed at offset 0 from the beginning of class.=20 Which is valid for verifyable_object but will *kill* any derived classes. Yep. coding bug on my behalf. Can you or Chris try the test run after changing the verifyable_object destructor to be virtual (thread.h, line 163). > class > pthread is a subclass of class verifyable_object, but it _does_ > have VMT to accommodate virtual method 'create'. As far as i can > understand from assembly, pointer to VMT is placed at the beginning of > object instance, at offset 0, while members are placed after it, so > 'magic' has offset 4. Thank you for digging, I imagine this took some time - and you've saved me a lot of head scratching.=20 =20 > Now, in verifyable_object_isvalid you're casing pointer to variable of > subclass to pointer to base class. Ain't it case of 'never do like > this'? I suppose to safely perform cast from subclass to base class > one should always use dynamic_cast(). It's a case of this is always ways ok to do - upcasting is FINE.. (it happens every time you call a virtual function in fact). It's never ok to case a base class to a subclass (known as downcasting) unless you use a static_cast or a dynamic_cast. http://www.cs.rpi.edu/~wiseb/xrds/ovp3-1.html What *may* be a regression in 3.2 is the apparent bug caused by the introduction of a VMT in a derived class. However, as we already have a destructor for verifyable_object, and in this instance it should be virtual, we get to sidestep the bullet - for now. Rob --=20 --- GPG key available at: http://users.bigpond.net.au/robertc/keys.txt. --- --=-bXM/NCYZY3UtTkmXmadN Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQA9ljY2I5+kQ8LJcoIRAjURAJ9bRKg6+K3OVJdOZ1U8sZYQmZElDQCfacyb eyV9a4olb02z+7AcO4eX04Y= =jrdh -----END PGP SIGNATURE----- --=-bXM/NCYZY3UtTkmXmadN--