Re: Attention ROOT users: bug in GCC

From: jarek Grebieszkow (Jarek.Grebieszkow@cern.ch)
Date: Mon Oct 20 1997 - 18:29:16 MEST


I think it is a problem with virtual function table generation. I
solved this problem by puting class definition and implementation in
separate files and adding in defnition file  #pragma interface and in
implementation file #pragma implementation . Second solution I think is to
add (if we keep definition and implementation it the same file)
implementation of that virtual function.

					Jarek

On Mon, 20 Oct 1997, Pasha Murat wrote:

> 
> 	Those of us who use  GCC-compiled ROOT shold be aware of a weird 
> compiler bug present in version 2.7.2.x:
> 
> declaration of virtual function in the class header makes compiler 
> (sometimes?)  to forget about the definitions of inline methods of this 
> class:
> ---------------------------------------------------------- test.cc
> class A {
>   int a;
> public:
>   A();
>   ~A();
>   inline int aa() { return 1; }
>   virtual int qqqq();
> };
> 
> main() {
>   A q;
>   int b = q.aa();
> }
> --------------------------------------------------
> /data35/upgrade/murat/run1>gcc -c test.cc ; nm test.o | grep aa
>          U aa__1A
> --------------------------------------------------------------------------------
> You see that *inline* method A::aa() body of which should normally be inserted 
> into the source code has been considered to be an *external* function by GCC. 
> 
> As ClassDef(..) macro contains declarations of virtual functions this may cause
> problems for people using GCC-compiled ROOT.
> 
> This "feature" is reproducible on IRIX 6.2 and on AIX 4.2.
> For some reasons switching ON optimization on AIX resolves the problem, on
> IRIX however it doesn't help. I didn't try versions of GCC other than 
> 2.7.2.1(IRIX) and 2.7.2.2(AIX Power PC).
> 
> The only other C++ compiler I tried on UNIX - KAI C++ (on IRIX 6.2) doesn't 
> have this bug.
> 							Regards, Pasha.
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET