Code generation Bug with egcs-1.0.2

Rolf Grossmann grossman@securitas.net
Fri Mar 20 10:03:00 GMT 1998


Hi,

there is a problem code generation problem with the current egcs C++ 
compiler: some code gets generated more than once. The following sample 
file should be enough to illustrate the problem:

------------------------------ cut here ------------------------------
#include <string>

class A {
public:
    typedef enum {
	VAL1, VAL2, VAL3
    } result_t;

    static result_t afun(void);
};

A::result_t
A::afun(void) 
{
    return VAL1;
}

class B {
public:
    typedef enum {
	VAL4, VAL5, VAL6
    }
    result_t;

    static result_t bfun(void);
};

B::result_t
B::bfun(void)
{
    return VAL4;
}

int
main(int argc, char *argv[])
{
    if (A::afun() != A::VAL1 || B::bfun() != B::VAL4)
	return 1;
    return 0;
}
------------------------------ cut here ------------------------------

If the file is called symtest.cc compiling it results in the following
error:

> g++ symtest.cc -o symtest
symtest.cc:131:FATAL:Symbol ___ne__H1Z8result_t_RCX01T0_b already defined.
> g++ -v
Reading specs from /home/egcs-1.0.2/lib/gcc-lib/i386-pc-bsdi2.1/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)

If you leave out the #include <string> everything is fine, so there is
something in the standard library that causes the effect.

The example should reproduce the problem on any platform, but if there
is anything I can do to help track down the problem, just ask.

Bye, Rolf.



More information about the Gcc-bugs mailing list