Bug with egcs 1.1.1 under alpha-dec-osf4.0b

Graham Simms graham@muscat.com
Thu Jan 14 07:06:00 GMT 1999


In trying to port a large application which successfully compiles with egcs
1.1.1 under linux, solaris2, Irix and HPUX to the Alpha platform. It
compiled successfully but I get a bizarre segmentation fault when I try and
run it. Unfortunately if I create a simple piece of code that performs the
same actions the bug no longer manifests.

The code does approximately the following.

baaobject *baaobj
fooobject *foo_obj = new fooobject();
baaobject = fooobject->createbaa();
cout << "3 value = " << baaobject->showx() << "\n";

with approximately the following methods:

baaobject *fooobject::createbaa() {
  baaobject *baa;
  baa = new baaobject(a, b);

  cout << "1 value = " << baa->showx() << "\n";

  baa->init();

  cout << "2 value = " << baa->showx() << "\n";

  return baa;
}

int baa::showx() {
  return(x_);
}

The above code isn't complete or necessarily syntactically correct but it
gives the general idea. When run It successfully displays the "1 value..."
and "2 value..." lines but SEGVs at the "3 value..." line. the pointer to
the object remains the same so I can only assume the contents of the object
are somehow being corrupted. If I fiddle around and create extra baaobjects
then I can make the "3 value..." line work but then it SEGVs later on in the
application when running the same method on the baaobject.

I guess that there is no way from the above you'll be able to diagnose any
possible compiler fault, but what can I do to provide you with the
information you need to find out what is happening?

Graham.
graham@muscat.com



More information about the Gcc-bugs mailing list