This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
egcs1.0.1 Internal compiler error.
- To: egcs-bugs at cygnus dot com
- Subject: egcs1.0.1 Internal compiler error.
- From: Wolfgang Wander <wwc at wizard dot mit dot edu>
- Date: Fri, 30 Jan 1998 16:24:32 -0500
* The version of GNU CC.
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
* A complete input file that will reproduce the bug.
----------------------------------------------------------------------
typedef double HepDouble;
typedef int HepInt;
typedef float HepFloat;
typedef bool HepBoolean;
class HepAListBase {
friend class HepAListIteratorBase;
protected:
inline HepAListBase();
HepAListBase(const HepAListBase &);
inline ~HepAListBase();
inline void insert(void *);
inline void insert(void * e, void * r);
inline void insert(void * e, unsigned pos);
inline void append(void *);
void append(void *, void *);
void append(const HepAListBase &);
void remove(void *);
void remove(const HepAListBase & l);
inline HepBoolean hasMember(void *) const;
void replace(void *, void *);
inline void * operator[] (unsigned) const;
int index(void *) const;
int fIndex(void *) const;
inline void * first() const;
inline void * last() const;
void operator = (const HepAListBase &);
public:
inline void remove(unsigned);
inline void removeAll();
void purge();
void reverse();
void swap(unsigned i1, unsigned i2);
inline int length() const;
inline HepBoolean empty() const;
inline HepBoolean isEmpty() const;
void realloc();
inline void sort( int (*compfunc)(const void*, const void*) );
protected:
void ** p;
int n;
void copyArray(register void ** dst, register void ** src, register int n);
void * & newInsert(register int);
void * & newAppend(register int);
void removeEntry(int);
};
inline HepAListBase::HepAListBase()
: p(0), n(0) {}
inline void HepAListBase::insert(void * e) {
if ( e ) newInsert(0) = e;
}
inline void HepAListBase::insert(void * e, void * r) {
if ( e ) newInsert(fIndex(r)) = e;
}
inline void HepAListBase::append(void * e) {
if ( e ) newAppend(n) = e;
}
inline void HepAListBase::insert(void * e, unsigned pos) {
if ( e && pos < n ) newInsert(pos) = e;
else append(e);
}
inline HepBoolean HepAListBase::hasMember(void * e) const {
return HepBoolean(index(e) >= 0);
}
inline void * HepAListBase::operator[] (unsigned i) const {
return ( i < n ) ? p[i] : 0;
}
inline void * HepAListBase::first() const {
return n ? p[0] : 0;
}
inline void * HepAListBase::last() const {
return n ? p[n-1] : 0;
}
inline void HepAListBase::removeAll() {
n = 0;
}
inline void HepAListBase::remove(unsigned i) {
if ( i < n ) removeEntry(i);
}
inline int HepAListBase::length() const {
return n;
}
inline HepBoolean HepAListBase::empty() const {
return HepBoolean(n == 0);
}
inline HepBoolean HepAListBase::isEmpty() const {
return HepBoolean(n == 0);
}
void HepAListBase::realloc() {
p = (void **) ( p? ::realloc(p,n*sizeof(void*)) :
malloc(n*sizeof(void*)) );
}
void HepAListBase::copyArray(register void ** dst, register void ** src,
register int arraySize) {
while ( --arraySize >= 0 ) *(dst++) = *(src++);
}
void * & HepAListBase::newInsert(register int ir) {
n++; realloc();
register int i;
for ( i = n-1; i > ir; i-- )
p[i] = p[i-1];
return i >= 0 ? p[i] : p[0];
}
void * & HepAListBase::newAppend(register int ir) {
n++; realloc();
register int i;
for ( i = n-1; i > ir; i-- )
p[i] = p[i-1];
return p[i];
}
void HepAListBase::removeEntry(int ir) {
for ( register int i = ir+1; i < int(n); i++ ) p[i-1] = p[i];
n--;
realloc();
}
void HepAListBase::append(void * e, void * r) {
if ( e ) {
int ir = index(r);
newAppend( ir >= 0 ? ir+1 : n ) = e;
}
}
void HepAListBase::append(const HepAListBase & l) {
int ln = l.n;
n += ln;
realloc();
copyArray(p+n-ln, l.p, ln);
}
void HepAListBase::operator = (const HepAListBase & l) {
if ( this != &l ) {
n = l.n;
realloc();
copyArray(p, l.p, n);
}
}
HepAListBase::HepAListBase(const HepAListBase & l)
: p((void **) malloc(l.n*sizeof(void*))), n(l.n) {
copyArray(p, l.p, n);
}
int HepAListBase::fIndex(void * e) const {
register int i = -1;
while ( ++i < int(n) ) if ( p[i] == e ) return i;
return -1;
}
int HepAListBase::index(void * e) const {
register int i = n;
while ( --i >= 0 && p[i] != e );
return i;
}
void HepAListBase::purge() {
int ie;
for ( int i = 0; i < int(n); i++ ) {
while ( (ie = index(p[i])) != i ) removeEntry(ie);
}
}
void HepAListBase::remove(const HepAListBase & l) {
register int i = l.n;
while ( --i >= 0 ) remove(l.p[i]);
}
void HepAListBase::remove(void * e) {
if ( e && n ) {
int ir;
while ( ( ir = index(e) ) >= 0 ) removeEntry(ir);
}
}
void HepAListBase::replace(register void * eo, register void * en) {
register int i = n;
register void ** q =p;
while ( --i >= 0 ) {
if ( *q == eo ) *q = en;
q++;
}
}
void HepAListBase::reverse() {
register int i = n / 2;
register void ** pf = p;
register void ** pl = p+n-1;
register void * t;
while ( i-- > 0 ) {
t = *pf;
*(pf++) = *pl;
*(pl--) = t;
}
}
void HepAListBase::swap(unsigned i1, unsigned i2) {
if ( i1 >= n || i2 >= n || i1 == i2) return;
void * e = p[i1];
p[i1]=p[i2];
p[i2] = e;
}
----------------------------------------------------------------------
* The command arguments you gave GNU CC or GNU C++ to compile that
$ g++ -c -O AListBase.cc
AListBase.cc: In method `void HepAListBase::realloc()':
AListBase.cc:89: warning: implicit declaration of function `int realloc(...)'
AListBase.cc:90: warning: implicit declaration of function `int malloc(...)'
AListBase.cc: In method `void *& HepAListBase::newInsert(int)':
AListBase.cc:97: Internal compiler error.
AListBase.cc:97: Please submit a full bug report to `egcs-bugs@cygnus.com'.
$
$ g++ -c AListBase.cc
AListBase.cc: In method `void HepAListBase::realloc()':
AListBase.cc:89: warning: implicit declaration of function `int realloc(...)'
AListBase.cc:90: warning: implicit declaration of function `int malloc(...)'
$
* The type of machine you are using, and the operating system name
and version number.
Linux 2.0.33 Dual-i686 gnu-libc1
or
Linux 2.0.33 i586 gnu-libc1
* The operands you gave to the `configure' command when you installed
the compiler.
configure --enable-shared
* A complete list of any modifications you have made to the compiler
source.
none
* Details of any other deviations from the standard procedure for
installing GNU CC.
none
* A description of what behavior you observe that you believe is
incorrect.
The compiler gets an internal compiler error is -O is enabled.
Thanks for egcs (and eventually for looking into this bug-report ;-)
Wolfgang
--
_/ _/ _/ _/ _/_/_/ Wolfgang Wander . http://wizard.mit.edu/~wwc/
_/ _/ _/ _/ _/ MIT-LNS . Email: wwc@mit.edu
_/_/_/ _/_/_/ _/ 77 Mass Ave 24-006 . Tel: (617) 253 5222
_/_/_/ _/_/_/ _/_/_/ Cambridge, MA 02139-4307 . Fax: (617) 258 6591