This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Strange behaviour in C++...
- To: "Christopher R. Jones" <cj at interlog dot com>, Fredrik Öhrström <d92-foh at nada dot kth dot se>
- Subject: Re: Strange behaviour in C++...
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 25 Aug 1999 10:02:45 -0300
- Cc: gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <3.0.32.19990825075547.009b3930@mail.interlog.com>
On Aug 25, 1999, "Christopher R. Jones" <cj@interlog.com> wrote:
> I am puzzled at the lack of attention this thread has received.
Maybe it's because it's a known bug, that has been pestering GNU/Linux
forever, because of the choice to enable -fvtable-thunks by default
quite a long time ago, for performance reasons, despite the bug? :-)
In fact, I seem to recall there was an attempt to fix it for gcc 2.95
(was it Martin v. Löewis?), but, if it ever got in the CVS tree, it
seems that it didn't work for this case :-(
I'm installing the following testcase in the testsuite:
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@dcc.unicamp.br>
// based on bug report by Fredrik Öhrström <d92-foh@nada.kth.se>
// Special g++ Options: -fvtable-thunks
// execution test - XFAIL *-*-*
#include <cstdlib>
using namespace std;
struct vbase {
virtual int get_a() const = 0;
};
struct base: virtual vbase {
int a;
base(int aa) : a(aa) {}
int get_a() const { return a; }
};
struct mid: base {
mid(int bb) : base(bb) {
// when mid is not in charge of vbase initialization,
// a derived-aware vtable is needed for vbase
if (((vbase*)this)->get_a() != bb)
abort();
}
};
struct derived: virtual mid {
derived(int cc) : mid(cc) {}
};
int main () {
derived(1);
}
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them