Internal compiler error in egcs-970922
Bernd Nottelmann
nottelm@ptp283.uni-muenster.de
Wed Sep 24 03:25:00 GMT 1997
The following code causes an "Internal compiler error":
----------------------------------------------------------
extern int foo(char* charset) ;
struct strRep
{
unsigned len;
unsigned sz;
char s[1];
};
strRep* string_Scat(strRep*, const char*, int, const char*, int);
class string
{
protected:
strRep* rep;
public:
string();
string(const string& x);
string(const char* t);
~string();
friend inline void cat(const string&, const char*, string&);
const char* chars() const;
unsigned int length() const;
};
inline void cat(const string& x, const char* y, string& r)
{
r.rep = string_Scat(r.rep, x.chars(), x.length(), y, -1);
}
inline string operator + (const string& x, const char* y) return r;
{
cat(x, y, r);
}
void set_status(string message);
class StatusDelay {
private:
string cause;
public:
StatusDelay(const string& c)
: cause(c)
{
set_status(cause + "...");
}
~StatusDelay()
{
set_status(cause + "...done.");
}
};
static char delay_message[] = "Filtering files";
static void searchRemote()
{
StatusDelay delay(delay_message);
if (!foo("blah")) return;
}
----------------------------------------------------------
(The code was extracted from ddd-2.1.1.)
It was compiled with
g++ -O[2] -c -o file.o file.C
Without optimization nothing happens.
My OS is linux-2.0.30, c-library is libc.so.5.4.39, egcs-version:
> g++ -v
Reading specs from
/usr/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.09/specs
gcc version egcs-2.90.09 970922 (gcc2-970802 experimental)
More information about the Gcc-bugs
mailing list