schmidt%siam.ics.uci.edu@orion.cf.uci.edu ("Douglas C. Schmidt") (09/27/88)
Hi,
The following short program fragment causes a failed assertion for g++
1.27 running on the Sparc.
----------------------------------------
#include <stream.h>
#include <ctype.h>
#include <Obstack.h>
#define NIL(TYPE) ((TYPE *)0)
class Word_Read : Obstack {
private:
int Length;
char *Curr_Word;
public:
Word_Read(int Default_Len = 80): (Default_Len), Length(0), Curr_Word(0) {
// Make the default something reasonable, like 80 columns.
}
Obstack::free; // Allow the derived type to inherit
// only this member function.
friend istream& operator>> (istream& s,Word_Read& Word) {
char c;
while (cin.good() && cin.get(c) && isspace(c)) {
;
}
do {
if (isalnum(c)) {
Word.Obstack::grow(c);
}
else if (isspace(c)) {
Word.Length = Word.Obstack::size();
Word.Curr_Word = (Word.Obstack::finish(0));
return(s);
}
} while (cin.good() && cin.get(c));
return(s);
}
};
----------------------------------------
The diagnostic is:
----------------------------------------
g++ version 1.27.0
/usr/public/lib/g++/gcc-cpp+ -v -I/cd/ua/schmidt/include/ -undef -D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix bug.cc /tmp/cca08687.cpp
GNU CPP version 1.27.0
/usr/public/lib/g++/gcc-c++ /tmp/cca08687.cpp -quiet -dumpbase bug.cc -fchar-charconst -noreg -version -o /tmp/cca08687.s
Failed assertion (0) at line 981 of `convert.c'.
GNU C++ version 1.27.0 (sparc) compiled by GNU C version 1.28.
/usr/public/g++: Program c++ got fatal signal 6.