Article View: gnu.g++.bug
Article #19g++ Ver 2.2.2 bug.
From: Ryuji Matsumoto
Date: Sat, 31 Oct 1992 17:31
Date: Sat, 31 Oct 1992 17:31
244 lines
6016 bytes
6016 bytes
This bug reports are for G++ version 2.2.2.
We're using Sparc stations running SunOs4.1.1.
Internal compiler error.
--
cp-class.c:2378: failed assertion `IDENTIFIER_TEMPLATE (t) != NULL_TREE'
/edu/lib/gcc-lib/sun4-sunos4.1/2.2.2/gcc: Internal compiler error: program cc1plus got fatal signal 6
--
Error message.
---------------------------------------------------------------------
kamo<Matumoto>[2] g++.2.2.2 -v bug.cxx
Reading specs from /edu/lib/gcc-lib/sun4-sunos4.1/2.2.2/specs
gcc version 2.2.2
/edu/lib/gcc-lib/sun4-sunos4.1/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 bug.cxx /usr/tmp/cca16986.i
GNU CPP version 2.2.2 (sparc)
/edu/lib/gcc-lib/sun4-sunos4.1/2.2.2/cc1plus /usr/tmp/cca16986.i -quiet -dumpbase bug.cc -version -o /usr/tmp/cca16986.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
bug.cxx:58: parse error before `0'
bug.cxx:58: syntax error before `0'
bug.cxx:58: syntax error before `.'
bug.cxx:63: syntax error before `='
bug.cxx:64: syntax error before `='
bug.cxx:66: syntax error before `='
bug.cxx:69: syntax error before `='
cp-class.c:2378: failed assertion `IDENTIFIER_TEMPLATE (t) != NULL_TREE'
/edu/lib/gcc-lib/sun4-sunos4.1/2.2.2/gcc: Internal compiler error: program cc1plus got fatal signal 6
kamo<Matumoto>[3]
-------
Program text.
This program have syntax error.
------
kamo<Matumoto>[3]
kamo<Matumoto>[3] cat bug.cxx
#include <stdio.h>
extern "C"
{
typedef unsigned long int size_t;
extern void* malloc(size_t size);
extern void free(void*);
extern size_t strlen(const char *);
extern void exit(int);
extern char *strcpy(char *, const char *);
extern int strcmp(const char*, const char*);
}
#define my_malloc(A) malloc(A)
unsigned int my_default_hash(char *c,unsigned int a_Hash_Size)
{
int i, k=0;
for(i=0;c[i] != '\0'; i++)
{
k+=c[i];
}
return (k% a_Hash_Size);
}
/*********************/
/* Attention *********/
typedef unsigned int (*func_type)(char*, unsigned int);
/*********************/
class Hash
{
/* define */
typedef struct _binary_tree
{
struct _binary_tree *left, *right;
char * key_word;
void * compo;
} binary_tree;
/* val */
binary_tree **Hash_Table;
unsigned int (*hash_func)(char *,unsigned int);
unsigned int Hash_Size;
unsigned int Max_String_Size;
binary_tree NIL;
protected:
virtual void compo_add(char *c, binary_tree *p,void *y)
{
}
virtual void compo_init(char *c, binary_tree *p,void *y)
{
}
public:
Hash(
unsigned int a_Hash_Size=101,
unsigned int a_Max_String_Size=256, /*********************/
unsigned int func_type a_hash_func=NULL /* <--- Syntax error.*/
) /*********************/
{
int i;
Hash_Size=a_Hash_Size;
Max_String_Size=a_Max_String_Size;
hash_func=a_hash_func;
if(hash_func == NULL)
{
hash_func=my_default_hash;
}
NIL.left=NULL;
NIL.right=NULL;
NIL.comp=NULL;
NIL.key_word=(char*)my_malloc(sizeof(char)*Max_String_Size);
Hash_Table=(binary_tree **)my_malloc(sizeof(binary_tree *)*Hash_Size);
if((NIL.key_word == NULL) || (Hash_Table == NULL))
{
fprintf(stderr,"Can't memory allocation.\n");
exit(1);
}
for(i=0;i<Hash_Size; i++)
{
Hash_Table[i]=&NIL;
}
}
binary_tree ** Find(char *c, int string_size= -1)
{
int comp;
binary_tree **p;
if(string_size < 0)
{
string_size=strlen(c);
}
if(string_size > Max_String_Size)
{
fprintf(stderr, "Error: getting string is very long.");
exit(1);
}
strcpy(NIL.key_word,c);
p=&Hash_Table[(*hash_func)(c,Hash_Size)];
while((comp = strcmp(c,(*p)->key_word)) != 0)
{
if(comp < 0)
{
p = &((*p)->left);
} else {
p = &((*p)->right);
}
}
return p;
}
void Insert(char *c, void *y, int string_size=-1)
{
binary_tree **p, *q;
p=Find(c,string_size);
if(*p != &NIL)
{
compo_add(c,q,y);
return;
}
if(((q = (binary_tree *)my_malloc(sizeof(binary_tree))) == NULL)
|| (q->key_word = (char*)my_malloc(string_size+1)) == NULL)
{
fprintf(stderr,"Can't memory allocation.\n");
exit(1);
}
strcpy(q->key_word, c);
q->left=&NIL;
q->right=&NIL;
*p=q;
compo_init(c,q,y);
}
char * Show(char *c,int string_size=-1)
{
binary_tree **p;
p=Find(c,string_size);
if(*p != &NIL)
{
return (*p)->key_word;
} else {
return NULL;
}
}
};
class Associate_Dimension: public Hash
{
typedef struct _etc
{
int count;
} etc;
void compo_add(char *c, binary_tree *p,void *y)
{
etc *q;
q=(etc*)y;
(q->count)++;
}
void compo_init(char *c, binary_tree *p,void *y)
{
etc *q;
q=(etc*)y;
(q->count)=1;
}
public:
char *Show(char *c)
{
Find(c,-1);
}
void *Insert(char*, char*)
{
}
};
kamo<Matumoto>[4]
---------------------------
Ryuji Matsumoto
Kyushu Institute of Technology.(Japan)
e-mail:matumoto@pluto.ai.kyutech.ac.jp
Technical Details
Message-ID:
<1992Oct31.173124.14168@ai.kyutech.ac.jp>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!msr.mei.co.JP!nadiaShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!msr.mei.co.JP!nadia From: nadia@msr.mei.co.JP (Ryuji Matsumoto) Subject: g++ Ver 2.2.2 bug. Message-ID: <1992Oct31.173124.14168@ai.kyutech.ac.jp> Sender: gnulists@ai.mit.edu Organization: Kyushu Institute of Technology, AI Dept, Iizuka, JAPAN. Distribution: gnu Date: Sat, 31 Oct 1992 17:31:24 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 245