[omniORB] Differences on RH and DEC

Matthew Berry mberry@mweb.co.za
Fri, 20 Apr 2001 09:45:06 +0200


Thanks for you input Bruce.

As you suspected, I am using the "Compaq C++ V6.2-024 for Digital UNIX V4.0F
(Rev. 1229)" compiler.

I compiled your test program (with and without a -O5 flag) and it outputted
"Did the right thing" both times. How can I check the machine code and what
must I look for?

If I recompile the omniORB libraries with different optimiser settings will
this problem go away?

Thanks

-----Original Message-----
From: Bruce Visscher [mailto:visschb@rjrt.com]
Sent: 19 April 2001 19:24
To: mberry@mweb.co.za
Cc: omniORB
Subject: Re: [omniORB] Differences on RH and DEC


Matthew,

What version of cxx are you using on OSF?  This sounds like a known
problem with the optimizer that comes with version 6.2 of Compaq C++.

Here is a reproducer:

------------------------------- TEST.CXX -------------------------------
#define __USE_STD_IOSTREAM
#include <iostream>

struct COMM_FAILURE{};

struct X {
  X() {
    flags.forward_location=0;
    flags.x1=0;
    flags.x2=0;
  }
  struct {
    unsigned forward_location : 1;
    unsigned x1 : 1;
    unsigned x2 : 1;
  } flags;

  void f() {
    int fwd;
    while (true) {
      try {
        fwd=flags.forward_location;
        doSomeWork();
      }
      catch (COMM_FAILURE& e) {
        if (fwd) {
          processLocationForward();
        } else {
          throw;
        }
      }
    }
  }
  void doSomeWork() {
    throw COMM_FAILURE();
  }

  void processLocationForward() {
    std::cout << "Here we go again!" << std::endl;
  }

};

int main() {
  X x;
  try {
    x.f();
  }
  catch (COMM_FAILURE) {
    std::cout << "Did the right thing!" << std::endl;
  }
}
------------------------------- TEST.CXX -------------------------------

If you compile and run this, it should say "Did the right thing!".  If
it says "Here we go again!" over and over, you need a newer compiler.
According to Compaq, version 6.3 fixes this bug on all platforms.  I
believe version 6.3 is the current release on Tru64.  It is in Beta on
OpenVMS.  It appears to be fixed on OpenVMS using the Beta compiler.

HTH,

Bruce
--

Bruce Visscher                                        visschb@rjrt.com
CONFIDENTIALITY NOTE:  This e-mail message, including any attachment(s),
contains information that may be confidential, protected by the
attorney-client or other legal privileges, and/or proprietary non-public
information.  If you are not an intended recipient of this message or an
authorized assistant to an intended recipient, please notify the sender by
replying to this message and then delete it from your system.  Use,
dissemination, distribution, or reproduction of this message and/or any of
its attachments (if any) by unintended recipients is not authorized and may
be unlawful.