[omniORB] gcc 3.0 with omniORB

Sai-Lai Lo s.lo@uk.research.att.com
Wed, 20 Jun 2001 15:28:05 -0000


This is a multi-part message in MIME format.

------=_NextPart_000_02DD_01C0F99D.99ECAB60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

In case you can't wait to use gcc 3.0 to compile omniORB, the following note
may save you hours of time debugging.

Essentially, the compiler generates wrong code for the ctor of a rather
complex multiplely inherited class. When the ctor is run, the program SEGV.
The 'rather complex multiplely inherited class' unfortunately is the POA
skeleton of a multiplely inherited interface:

interface Echo {
};

interface DerivedEcho : Echo {
};

interface MoreEcho {
};

interface MultiEcho : DerivedEcho, MoreEcho {
};

Simple single inheritance seems to work. If you have to use multiple
inheritance in your IDL, you've been warned.

omniORB 3.0 can be compiled with gcc 3.0. The only change necessary is in
$(top)/src/appl/omniNames/log.cc:

#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x500
#define USE_STREAM_OPEN
#define OPEN(name,mode,perm) open(name,mode,perm)
#elif defined(__KCC)
#define USE_STREAM_OPEN
#define OPEN(name,mode,perm) open(name,mode)
#elif defined(__GNUG__) && __GNUG__ >= 3              <---
#define USE_STREAM_OPEN                               <---
#define OPEN(name,mode,perm) open(name,mode)          <---
#endif

Sai-Lai

PS. If you are interested in knowing a test case to reproduce the gcc bug,
see the attached file.



------=_NextPart_000_02DD_01C0F99D.99ECAB60
Content-Type: application/octet-stream;
	name="t.cc"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="t.cc"

#include <iostream.h>=0A=
=0A=
class C_5 {=0A=
public:=0A=
  C_5() {=0A=
    cerr << "C_5" << endl;=0A=
  }=0A=
};=0A=
=0A=
class B_5 : public virtual C_5 {=0A=
public:=0A=
  B_5() {=0A=
    cerr << "B_5" << endl;=0A=
  }=0A=
};=0A=
=0A=
=0A=
class C_4 {=0A=
public:=0A=
  C_4() {=0A=
    cerr << "C_4" << endl;=0A=
  }=0A=
};=0A=
=0A=
class B_4 : public virtual B_5 {=0A=
public:=0A=
  B_4() {=0A=
    cerr << "B_4" << endl;=0A=
  }=0A=
};=0A=
=0A=
class A_4 : public virtual C_4,=0A=
	    public virtual B_5 {=0A=
public:=0A=
  A_4() {=0A=
    cerr << "A_4" << endl;=0A=
  }=0A=
};=0A=
=0A=
class D_4 : public virtual C_5 {=0A=
public:=0A=
  D_4() {=0A=
    cerr << "D_4" << endl;=0A=
  }=0A=
};=0A=
=0A=
class A_3 : public virtual B_4,=0A=
            public virtual D_4 {=0A=
public:=0A=
  A_3() {=0A=
    cerr << "A_3" << endl;=0A=
  }=0A=
};=0A=
=0A=
class B_3 : public virtual A_4,=0A=
          public virtual B_4 {=0A=
public:=0A=
  B_3() {=0A=
    cerr << "B_3" << endl;=0A=
  }=0A=
};=0A=
=0A=
=0A=
=0A=
class C_3 : public virtual C_4,=0A=
          public virtual D_4 {=0A=
public:=0A=
  C_3() {=0A=
    cerr << "C_3" << endl;=0A=
  }=0A=
};=0A=
=0A=
class A_2 : public virtual A_3,=0A=
          public virtual B_3,=0A=
          public virtual C_3 {=0A=
public:=0A=
  A_2() {=0A=
    cerr << "A_2" << endl;=0A=
  }=0A=
};=0A=
=0A=
class A_1 : public virtual A_2 {=0A=
public:=0A=
  A_1() {=0A=
    cerr << "A_1" << endl;=0A=
  }=0A=
};=0A=
=0A=
int=0A=
main(int, char**) {=0A=
  A_1 a1;=0A=
  return 0;=0A=
}=0A=

------=_NextPart_000_02DD_01C0F99D.99ECAB60--