This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Many pthread failures in the test suite, one setgroup failure


On Sun, 2002-09-29 at 10:02, Christopher Faylor wrote:

> >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).
> 
> Already did that.  It brings the pthread test suite failures down to
> 1 for pthread-condvar6.  assertion output is below.

Ok, looking into this in shortly.
 
> >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.
> 
> I was thinking that it made sense to make the destructor virtual anyway.
> But now, I'm worried about other parts of cygwin which are not exercised
> by the test suite.  Maybe they will have problems, too.
> 
> Isn't this actually a bug?

Uhm what in?
The missing virtual on the destructor *is* a bug in my code.
gcc 3.2 having trouble with derived classes that have virtual methods of
base classes with no virtuals methods is also (IMO) a bug and one in
gcc.

However, there is a thing called the rule of three:
if a class has explictly decalared any of:
copy constructor
assignment operator
destructor

it MUST declare all three. Or else bad things happen (usually with
remote storage). This isn't bad-because-of-compiler, but
bad-because-of-programming-logic-errors.

In this specific case, gcc was doing the right thing. I believe I could
construct a test case to make gcc to the wrong thing though.

Something like:

class myBase{
public:
  myBase (int anInt):_value(anInt){}
  int getvalue() {return _value;}
private:
  int _value;
};

class myDerived {
   myDerived (int anInt) : myBase (anInt);
  virtual void confusebase(){return getvalue();}
  };

should do it.

Rob
-- 
---
GPG key available at: http://users.bigpond.net.au/robertc/keys.txt.
---

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]