Problem with virtual inheritance and virtual functions

Jacques Gelinas jack@solucorp.qc.ca
Sun Mar 12 18:35:00 GMT 2000


On Tue, 29 Feb 2000, Martin v. Loewis wrote:

Just a partial report

> > > That patch operates on top of 2.95.2 (actually, on the release branch
> > > 2.95.3); it does not work on top of the mainline compiler.
> > 
> > I will look at the patch. Will it work on 2.96, the last version in the
> > CVS tree.
> 
> Was that a question? No, as I said - it won't work with the CVS
> mainline, it is for 2.95 only.

I have tried it with the official 2.95.2 + your patch. My original tests
did work (they were failing with stock egcs, any version, but were working
on g++ 2.7).

I have tried to get the latest 2.95 from the CVS tree, but this version
was not compiling properly (breaking somewhere while building objc with
xgcc, so I assume that xgcc has a flaw in this version). I have tried that
on two different machines btw, to make sure it was not a ram problem.

Anyway, back to official 2.95.2 + thunk patch

Applied to my project, things are not working. The behavior is different.
With the stock egcs, virtual function are called with invalid this
(wrongly ajusted). Now, the program segfault whenever a virtual function 
is called from a constructor (it seems the virtual function.

I am now trying to figure out what is specific to this project so I can
replicate with a simple example, like I did originally.

I am using binutils 2.9.5.0 btw.
 
> > Yes I will. Our project is stuck with redhat 5.0 and we would like
> > to move on.
> 
> In case this isn't clear so far, there is an easy solution: Do not
> call virtual functions in a constructor, or arrange the calls to be
> non-virtual. That way, you avoid the bug.

I know. This is fairly large though :-(
 

---------------------------------------------------------
Jacques Gelinas <jack@solucorp.qc.ca>
virtualfs: Automounting floppy, CDs, network share, etc...
http://www.solucorp.qc.ca/



More information about the Gcc-bugs mailing list