Attention ROOT users: bug in GCC

From: Pasha Murat (murat@cdfsga.fnal.gov)
Date: Mon Oct 20 1997 - 17:50:32 MEST


	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