This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal compiler error in gcc
- To: egcs-bugs at cygnus dot com
- Subject: Internal compiler error in gcc
- From: Daniel Suson <suson at newton dot tamuk dot edu>
- Date: Tue, 9 Jun 1998 07:57:25 -0500 (CDT)
Dear Sir or Madam,
I am using the egcs-1.0.3a release on a linux system, kernel
version 2.0.30. I am trying to compile some c++ code for a project that I
am working on and encountered the following error:
AListBase.cxx: In method `void *& HepAListBase::newInsert(int)':
AListBase.cxx:31: Internal compiler error. AListBase.cxx:31: Please submit
a full bug report to `egcs-bugs@cygnus.com'.
The command line generated by the Makefile for this routine is
g++ -I/usr/include/egcs -I.. -g -Wall -ansi -pedantic -Wwrite-strings
-Wpointer-arith -Wnested-externs -W -Woverloaded-virtual
-Wbad-function-cast -O -c AListBase.cxx
I am attaching a copy of the file which generated this error. Please let
me know what, if anything, I can do to fix or work around this error as
quickly as possible. If there is other information which is needed,
please contact me at this address.
Thank You,
Dan
=====================================================================
| Daniel Suson | Physics Department |
| D-Suson@tamuk.edu | C.B. 175 |
| http://newton.tamuk.edu/~suson | Texas A&M University-Kingsville |
| 512-593-2299 (voice) | Kingsville, TX 78363 |
| 512-593-2296 (fax) | 512-593-2618 |
=====================================================================
// -*- C++ -*-
//
// This file is a part of what might become the CLHEP -
// a Class Library for High Energy Physics.
//
// This is the implementation of the HepAListBase class.
//
#ifdef __GNUC__
#pragma implementation
#endif
#include "CLHEP/CLHEP.h"
#include "CLHEP/AListBase.h"
#ifdef HEP_DEBUG_INLINE
#include "CLHEP/AListBase.icc"
#endif
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 n) {
while ( --n >= 0 ) *(dst++) = *(src++);
}
void * & HepAListBase::newInsert(register int ir) {
n++; realloc();
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();
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) {
unsigned 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;
}
// -*- C++ -*-
//
// This file is a part of what might become CLHEP -
// a Class Library for High Energy Physics.
//
// This is the definition of the HepAListBase class which is the base class
// used in the template classes HepAList and HepConstAList.
//
// .SS See Also
//
// AList.h, AIterator.h, ConstAList.h, ConstAIterator.h, AIteratorBase.h
//
// .SS History
// HepAListBase was developed from an original (non-template) list class
// written by Dag Bruck.
//
// Author: Leif Lonnblad
//
#ifndef _ALISTBASE_H_
#define _ALISTBASE_H_
#ifdef __GNUC__
#pragma interface
#endif
#include "CLHEP/CLHEP.h"
#include <stdlib.h>
#ifdef HEP_NO_INLINE_IN_DECLARATION
#define inline
#endif
class HepAListBase {
friend class HepAListIteratorBase;
protected:
inline HepAListBase();
// Constructs a list with no objects.
HepAListBase(const HepAListBase &);
// Copy constructor
inline ~HepAListBase();
// Destroys the list. The objects in the list are not destroyed.
// Use HepAListDeleteAll(HepAList<T> &) to destroy all objects in the list.
inline void insert(void *);
// Inserts an object first in the list.
inline void insert(void * e, void * r);
// Inserts the object e just before the first occurence of
// object r in the list.
inline void insert(void * e, unsigned pos);
// Inserts the object e at the position pos in the list. If pos is outside
// the list, the object will be appended.
inline void append(void *);
// Appends an object in the end of the list
void append(void *, void *);
// Appends the object e just after the last occurrence of object r
// in the list
void append(const HepAListBase &);
// Appends all objects of list l to the end of this list.
void remove(void *);
// Remove all occurencies of the object from the list.
void remove(const HepAListBase & l);
// Remove all occurencies of the objects in list l from this list.
inline bool hasMember(void *) const;
// Returns true if the object is a member of the list.
void replace(void *, void *);
// Replace all occurencies of object eo with object en.
inline void * operator[] (unsigned) const;
// return a pointer to the object in position i (the first element has i=0).
int index(void *) const;
// Returns the index of the last occurrence of the object.
// NOTE! the objects are numbered 0 to n-1.
int fIndex(void *) const;
// Returns the index of the first occurence of the object.
// NOTE! the objects are numbered 0 to n-1.
inline void * first() const;
inline void * last() const;
// Returns a pointer to the first and last object in the list.
void operator = (const HepAListBase &);
// Assignment.
public:
inline void remove(unsigned);
// Remove an object from the list.
inline void removeAll();
// Remove all objects from the list.
void purge();
// Remove all duplicate objects in the list.
void reverse();
// Reverse the order in the list.
void swap(unsigned i1, unsigned i2);
// Swap the position of objects number i1 and i2.
inline unsigned length() const;
// Returns the number of objects in the list
inline bool empty() const;
inline bool isEmpty() const;
// Returns true if the list is empty.
void realloc();
// reallocates the array of pointers in the list
protected:
void ** p;
// Array of pointers to actual member objects.
unsigned n;
// Number of objects in the list.
void copyArray(register void ** dst, register void ** src, register int n);
// Internal function for fast copying of arrays.
void * & newInsert(register int);
// Allocate space for a new object before entry number ir
void * & newAppend(register int);
// Allocate space for a new object after entry number ir
void removeEntry(int);
// Remove one entry in the list.
};
#ifdef HEP_NO_INLINE_IN_DECLARATION
#undef inline
#endif
#ifndef HEP_DEBUG_INLINE
#include "CLHEP/AListBase.icc"
#endif
#endif
// -*- C++ -*-
//
// This file is a part of what might become the CLHEP -
// a Class Library for High Energy Physics.
//
// This is the definitions of the inline member functions of the
// HepAListBase class
//
#ifdef HEP_DEBUG_INLINE
#define inline
#endif
inline HepAListBase::HepAListBase()
: p(0), n(0) {}
inline HepAListBase::~HepAListBase() {
free(p);
}
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 bool HepAListBase::hasMember(void * e) const {
return bool(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 unsigned HepAListBase::length() const {
return n;
}
inline bool HepAListBase::empty() const {
return bool(n == 0);
}
inline bool HepAListBase::isEmpty() const {
return bool(n == 0);
}
#ifdef HEP_DEBUG_INLINE
#undef inline
#endif