[gnu.g++.bug] g++ 1.36.1 bugs/suggestions

strauss@AEROSPACE.AERO.ORG (12/10/89)

We have sun3 and Sun4 running SunOS 4.0 and g++-1.36.1.

First, I would like to make a small suggestion. When I tried to compile
libg++ I kept finding that g++ was generating bad assembly code. The
problem was the CTOR and DTOR stabs. It wasn't clear to me that I HAD to
use gas. In fact, I would have used it, except that I didn't
see any way to change the choice of assembler in the Makefile. I ended
up changing gcc.c to use gas instead of as. Would it be possible to
include a configuration parameter for the choice of assembler's in the
Makefile of the next release?

The behavoir of enums seems to have changed from 1.35 to 1.36 and I am
not sure if this is a bug or a "correction". Under 1.35 the following
code would output "FIRST", but it now outputs "0". It appears that the
enum is being handled as an int, and my definition of operator<< is
never being called.

#include <stream.h>

enum foo {FIRST, SECOND};

ostream &operator<<(ostream &os, enum foo it)
{
  switch (it) {
  case FIRST:
    os << "FIRST";
    break;
  default:
    os << "OTHER";
    break;
  }
}

main()
{
  enum foo bar;

  bar=FIRST;
  cout << bar << "\n";
}

Finally, things seem very weird with multiple inheritence. It appears
that GDB 3.4 doesn't understand multiple inheritence very well. Look at
the following source file:

#include <stream.h>

class foo {
 public:
  int x;
};

class bar {
 public:
  int y;
};

class baz : public foo, public bar {
 public:
  int z;
};

main()
{
  baz moo;

  moo.x=1;
  moo.y=2;
  moo.z=3;
  cout << "moo.x " << moo.x << " moo.y " << moo.y << " moo.z " << moo.z << "\n";
}

If I go into GDB and print moo before the output line I get this:

(gdb) p moo
$1 = {
<foo> = {x = 2}
<bar> = {x = 0}
  members of baz: z = 3}

It appears the GDB knows that there exists a class bar in moo, but it
thinks the structure is that of foo. I am having other problems with
multiple inheritence, but not being able to get GDB to print descent
results makes it hard to prune the example down (or even decide if it
really is my bug not the compiler's)

Are any of these slated to be fixed in 1.36.2? If you would like any
more information on any of these problems (or my source to the other
multiple inherintence problem) drop me email and I would be happy to
send them to you.

					- |Daryll

-------------------------------------------------------------------------------
Daryll Strauss          			f	The Aerospace Corp.
strauss@aero.org		      		n	Mail Stop: M1-102
...!uunet!aero.org!strauss			o	P.O. Box 92957
                                                r       Los Angeles, Ca. 90009
Suggestions for a quote to the address above.	d	(213) 336-9358
- -------------------------------------------------------------------------------



------- End of Forwarded Message