Article View: gnu.g++.bug
Article #1211compiler error in g++
From: Jeffrey Putnam
Date: Mon, 16 Nov 1992 05:16
Date: Mon, 16 Nov 1992 05:16
954 lines
15940 bytes
15940 bytes
G++ gives me a compiler error and asks "please report". The following
is a script file that shows what I believe you need. It seems
that it does not like making a table of pointers to member functions -
unhappily, I need such.
Script started on Sat Nov 14 08:27:30 1992
oberon.1 : g++ -v ops.C
Reading specs from /usr/local/lib/gcc-lib/sun4/2.2.2/specs
gcc version 2.2.2
/usr/local/lib/gcc-lib/sun4/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix ops.C /usr/tmp/cca22075.i
GNU CPP version 2.2.2 (sparc)
/usr/local/lib/gcc-lib/sun4/2.2.2/cc1plus /usr/tmp/cca22075.i -quiet -dumpbase ops.cc -version -o /usr/tmp/cca22075.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
ops.C: In method `void molecule::DoInstruction (unsigned char)':
ops.C:430: internal compiler error 116, please report
oberon.2 : g++ -S ops.C
ops.C: In method `void molecule::DoInstruction (unsigned char)':
ops.C:430: internal compiler error 116, please report
oberon.3 : g++ -E ops.C
# 1 "ops.C"
# 1 "/usr/local/lib/g++-include/stdlib.h" 1 3
# 1 "/usr/local/lib/g++-include/stddef.h" 1 3
extern "C" {
# 1 "/usr/local/lib/gcc-lib/sun4/2.2.2/include/stddef.h" 1 3
typedef int ptrdiff_t;
typedef int size_t;
typedef short unsigned int wchar_t;
# 7 "/usr/local/lib/g++-include/stddef.h" 2 3
}
# 6 "/usr/local/lib/g++-include/stdlib.h" 2 3
extern "C" {
int abs(int);
void volatile abort(void);
double atof(const char*);
int atoi(const char*);
long atol(const char*);
int atexit(auto void (*p) (void));
int bsearch (const void *, const void *, size_t,
size_t, auto int (*ptf)(const void*, const void*));
void* calloc(size_t, size_t);
void cfree(void*);
void volatile exit(int);
char* fcvt(double, int, int*, int*);
void free(void*);
char* getenv(const char*);
int getopt(int, const char**, const char*);
int getpw(int, char*);
char* gcvt(double, int, char*);
char* ecvt(double, int, int*, int*);
extern char** environ;
long labs(long);
void* malloc(size_t);
size_t malloc_usable_size(void*);
int putenv(const char*);
extern char* optarg;
extern int opterr;
extern int optind;
void qsort(void*, size_t, size_t, auto int (*ptf)(void*,void*));
int rand(void);
void* realloc(void*, size_t);
int setkey(const char*);
int srand(unsigned int);
double strtod(const char*, char**);
long strtol(const char*, char**, int);
unsigned long stroul(const char**, int);
int system(const char*);
long random(void);
void srandom(int);
char* setstate(char*);
char* initstate(unsigned, char*, int);
double drand48(void);
void lcong48(short*);
long jrand48(short*);
long lrand48(void);
long mrand48(void);
long nrand48(short*);
short* seed48(short*);
void srand48(long);
char* ctermid(char*);
char* cuserid(char*);
char* tempnam(const char*, const char*);
char* tmpnam(char*);
}
# 1 "ops.C" 2
# 1 "molecule.h" 1
void bcopy(unsigned char *, unsigned char *, int) ;
typedef unsigned char atom ;
class instructions
{
protected:
int length ;
atom *contents ;
class molecule *molly ;
public:
instructions() { length = 100 ;
contents = (atom *) malloc(100 * sizeof(atom)) ; } ;
instructions(int s) { length = s ;
contents = (atom *) malloc(s * sizeof (atom)) ;} ;
instructions(atom *i, int s) { length = s ;
contents = (atom *) malloc(s * sizeof (atom)) ;
bcopy(i, contents, s) ; } ;
void grow () { length += 100 ;
contents = (atom *) realloc(contents, length * sizeof(atom)) ; } ;
atom atom_at(int i) { if ((i > 0) && (i < length))
return(contents[i]) ;
else return(0) ; } ;
int size() { return(length) ; }
} ;
class context
{
instructions *atom_stream ;
int offset ;
public:
context(molecule *ma) ;
context (instructions *i, molecule *ma) ;
context *Clone (molecule *ma) ;
void reset () { offset = 0 ; } ;
void Skip (int i) { offset += i ; } ;
atom next () { return(atom_stream->atom_at(offset++)) ; };
void insert_atom(atom a) ;
void break_instr () ;
void join(context *joiner) ;
atom *GetID() ;
void ReadIdAtoms(class operand_stack *os) ;
context *FindLabel(atom a, int direction) ;
int end_p() { return(offset = atom_stream -> size()) ; };
int begin_p () { return (offset = 0) ; }
} ;
const int stack_size = 100 ;
struct context_stack
{
context **stack ;
int pointer ;
int cs_size = stack_size ;
public:
context_stack() { pointer = 0 ; stack = (context **)malloc(sizeof(context *) * cs_size); };
void Push (context *c) { stack[pointer++] = c ;
if (pointer > cs_size)
{
cs_size += stack_size ;
} } ;
context *Pop() { if (pointer <= 0)
{
return (0) ;
pointer = 0 ;
}
else
{
return(stack[--pointer]) ;
} } ;
int empty() { return(pointer == 0) ; }
int full() { return(0) ; }
void reset () { pointer = 0 ; } ;
} ;
class operand_stack
{
atom *contents ;
int top ;
int size ;
public:
operand_stack() { size = 100 ;
contents = (atom *) malloc(size *sizeof(atom)) ;
top = 0 ; }
void Push (atom a) { if (top == size)
{
size += 100 ;
contents = (atom *)realloc(contents, size * sizeof(atom)) ;
}
contents[top++] = a ; }
atom Pop () { if (top > 0) return(contents[--top]) ; else return(0); }
atom nth (int n){ return((top - n) > 0 ? contents[top-n] : 0) ; } ;
void reset() { top = 0 ; } ;
} ;
class molecule
{
atom id[4] ;
operand_stack Stack ;
instructions *Contents ;
context *Contexts[4] ;
context_stack ContextStack ;
molecule *MoleculeGrabbers[4] ;
int waiting = 0 ;
atom PatternID[4] ;
atom *PatternContents ;
double damage ;
public :
void execute(int n) ;
void set_instructions(instructions *insts) {Contents = insts;} ;
void add_context(context *) ;
instructions *data() { return( Contents) ; } ;
void match(atom) ;
void DoInstruction (atom instr) ;
void oops () { damage += 1 ; if (damage >= 255) die() ; };
void die () ;
void Skip (int i) ;
atom next () { return ( Contexts[0] -> next()) ; } ;
void GetID();
void PushContext() ;
void PopContext() ;
void literal() ;
void Pop() ;
void dup() ;
void exch() ;
void copy() ;
void if_instr () ;
void not() ;
void and() ;
void or() ;
void add() ;
void mult() ;
void divide() ;
void subtract() ;
void neg() ;
void reset() ;
void set_context() ;
void read_instr() ;
void write_instr() ;
void break_instr() ;
void join_instr() ;
void wait() ;
void call() ;
void label() ;
void return_instr() ;
void exec_instr() ;
void detach() ;
void detach_and_exec() ;
void find_label_forward() ;
void find_label_backward() ;
void equal() ;
void gt() ;
void lt() ;
void end_p() ;
void begin_p() ;
void start_molecule() ;
void reset_context() ;
void nop() ;
void get_damage() ;
void getID() ;
void startMolecule() ;
void JumpForwardLabel() ;
void JumpBackwardLabel() ;
void JumpForwardCount() ;
void JumpBackwardCount() ;
} ;
struct InstructionFunction
{
char *name ;
void (molecule::*function)() ;
} ;
int InstructionSetSize ;
InstructionFunction *InstructionTable[256] ;
# 2 "ops.C" 2
# 1 "monitor.h" 1
const int soup_size = 10 ;
class monitor
{
class molecule *soup[soup_size] ;
class molecule *current_molecule ;
public:
Birth(class molecule *, class context *, int dead_or_alive=1) ;
die (class molecule *) ;
wait(class molecule *, class molecule *) ;
} ;
monitor SoupMachine ;
# 3 "ops.C" 2
context::context(molecule *ma)
{
atom_stream = new instructions(100);
offset = 0 ; ma -> add_context(this) ;
}
context::context (instructions *i, molecule *ma)
{
atom_stream = i ;
offset = 0 ;
ma -> add_context(this);
}
context
*context::Clone (molecule *ma)
{
context *res = new context (atom_stream, ma) ;
res -> offset = offset ;
return (res) ;
}
void
molecule::literal()
{
Stack . Push(next()) ;
}
void
molecule::Pop()
{
Stack . Pop () ;
}
void
molecule::dup()
{
atom a ;
a = Stack . Pop() ;
Stack . Push(a) ;
Stack . Push(a) ;
}
void
molecule::copy()
{
atom a,b ;
int s ;
a = Stack . Pop() ;
b = Stack . nth((int) a) ;
Stack . Push(b) ;
}
void molecule::exch()
{
atom a, b ;
a = Stack . Pop() ;
b = Stack . Pop() ;
Stack . Push (a) ;
Stack . Push (b) ;
}
void molecule::not()
{
atom a ;
a = Stack . Pop () ;
Stack . Push( !a ) ;
}
void molecule::and()
{
atom a,b ;
a = Stack . Pop () ;
b = Stack . Pop () ;
Stack . Push (a && b) ;
}
void molecule::or()
{
atom a,b ;
a = Stack . Pop () ;
b = Stack . Pop () ;
Stack . Push (a || b) ;
}
void molecule::add()
{
atom a,b ;
a = Stack . Pop () ;
b = Stack . Pop () ;
Stack . Push (a + b) ;
}
void molecule::mult()
{
atom a,b ;
a = Stack . Pop () ;
b = Stack . Pop () ;
Stack . Push (a * b) ;
}
void molecule::divide()
{
atom a,b ;
a = Stack . Pop () ;
b = Stack . Pop () ;
if (b != 0)
{
Stack . Push (a % b) ;
Stack . Push (a / b) ;
}
else
{
Stack . Push (255) ;
Stack . Push (255) ;
}
}
void molecule::subtract()
{
atom a,b ;
a = Stack . Pop () ;
b = Stack . Pop () ;
if ((a - b) > 0) Stack . Push(a-b) ; else Stack . Push (255 - (a - b)) ;
}
void molecule::gt()
{
atom a,b ;
a = Stack . Pop() ;
b = Stack . Pop () ;
Stack . Push (a > b) ;
}
void molecule::lt()
{
atom a,b ;
a = Stack . Pop() ;
b = Stack . Pop () ;
Stack . Push (a < b) ;
}
void molecule::equal()
{
atom a,b ;
a = Stack . Pop() ;
b = Stack . Pop () ;
Stack . Push (a == b) ;
}
void molecule::get_damage()
{
Stack . Push((atom) damage) ;
}
void
molecule::if_instr()
{
atom a ;
a = Stack . Pop() ;
if (a != 0)
{
Skip(3) ;
}
}
void molecule::die ()
{
free (Contents) ;
}
void molecule::Skip (int how_many)
{
Contexts[0] ->Skip(how_many) ;
}
void molecule::reset()
{
if ( Contexts[1] != ((void *)0) ) Contexts[1] -> reset() ;
if ( Contexts[2] != ((void *)0) ) Contexts[2] -> reset() ;
Stack . reset() ;
ContextStack . reset() ;
}
void molecule::read_instr()
{
atom a ;
a = Contexts[1] -> next() ;
Stack . Push(a) ;
}
void molecule::write_instr()
{
atom a = Stack . Pop() ;
Contexts[2] -> insert_atom(a) ;
}
void molecule::break_instr()
{
if ( Contexts[2] != ((void *)0) )
{
Contexts[2] -> break_instr();
}
else
{
oops() ;
}
}
void molecule::wait()
{
waiting = 1 ;
}
void molecule::getID()
{
atom *a ;
int i ;
a = Contexts[1] -> GetID() ;
for (i = 0 ; i < 4 ; i++)
{
Stack . Push(a[i]) ;
}
}
void molecule::PushContext()
{
atom a ;
a = Stack . Pop() ;
ContextStack . Push(Contexts[a & 3] -> Clone(this)) ;
}
void molecule::PopContext ()
{
atom a ;
a = Stack . Pop() ;
Contexts[a & 3] = ContextStack . Pop () ;
}
void molecule::call()
{
atom a = Stack . Pop () ;
ContextStack . Push( Contexts[0] ) ;
ContextStack . Push( Contexts[0] -> FindLabel(a,1)) ;
Contexts[0] = ContextStack . Pop () ;
}
void molecule::detach()
{
SoupMachine . Birth(this, Contexts[2] , 0) ;
}
void molecule::detach_and_exec()
{
SoupMachine . Birth(this, Contexts[2] ) ;
}
void molecule::find_label_forward()
{
atom a,b ;
a = Stack . Pop () ;
b = Stack . Pop() & 3 ;
ContextStack . Push(Contexts[b] -> FindLabel(a,1)) ;
}
void molecule::find_label_backward()
{
atom a = Stack . Pop () ;
atom b = Stack . Pop () & 3 ;
ContextStack . Push(Contexts[b] -> FindLabel(a,-1)) ;
}
void molecule::end_p()
{
atom a = Stack . Pop() ;
Stack.Push(Contexts[a&3] -> end_p()) ;
}
void molecule::begin_p()
{
atom a = Stack . Pop() ;
Stack.Push(Contexts[a&3] -> begin_p()) ;
}
void molecule::start_molecule()
{
}
void molecule::reset_context()
{
atom a = Stack . Pop () ;
Contexts[a & 3] -> reset () ;
}
void molecule::label()
{
next () ;
}
void molecule::JumpForwardLabel()
{
atom a ;
a = Stack . Pop () ;
ContextStack . Push( Contexts[0] -> FindLabel(a,1)) ;
Contexts[0] = ContextStack . Pop () ;
}
void molecule::JumpBackwardLabel()
{
atom a ;
a = Stack . Pop () ;
ContextStack . Push( Contexts[0] -> FindLabel(a, -1)) ;
Contexts[0] = ContextStack . Pop () ;
}
void molecule::JumpBackwardCount()
{
atom a ;
a = Stack . Pop() ;
Contexts[0] -> Skip(-a) ;
}
void molecule::JumpForwardCount()
{
atom a ;
a = Stack . Pop() ;
Contexts[0] -> Skip(a) ;
}
void molecule::nop()
{
damage -= 0.2 ;
}
void molecule::execute(int n)
{
int i ;
atom a ;
for (i = 0 ; i < n ; i++)
{
a = Contexts[0] -> next () ;
DoInstruction(a) ;
}
}
inline void molecule::DoInstruction(atom instr)
{
extern InstructionFunction *InstructionTable[] ;
(InstructionTable[instr]->function)() ;
};
oberon.4 : exit
exit
script done on Sat Nov 14 08:28:53 1992
Technical Details
Message-ID:
<9211161916.AA04134@minos.nmt.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!minos.nmt.edu!jefuShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!minos.nmt.edu!jefu From: jefu@minos.nmt.edu (Jeffrey Putnam) Subject: compiler error in g++ Message-ID: <9211161916.AA04134@minos.nmt.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Mon, 16 Nov 1992 05:16:12 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 955