This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Internal compiler error 9


I compiled a simple program of mine using your compiler and it caused an 
internal compiler error 9 in line 29 of list.h
list.h was included from list_f.h line 2.

As the compiler asked me to send a bug report to You, I obey

Additional information

cat /proc/version 
     provides information:

Linux version 2.0.15 (root@......) (gcc version 2.7.2) #2 Fri Jan 17 
12:30:15 MET 1997

Operator of the Linux system says, that we use Slackware.

And I can provide You no more information.

                        Szymon Nowakowski
all:  list_f.o


list_f.o:	list_f.cc	list_f.h	list.h
#include <math.h>  //pow()
#include "list.h"

int min(int a,int b)
{
 if (a<b) return a;
 return b;
};


list<float> operator+(const list<float> & a ,const list<float> & b)
{
 int i;
 list<float> wyn(min(a.count,b.count));

 for (i=0;(i<a.count) && (i<b.count);i++)
     wyn[i]=element(a,i)+element(b,i);
 return wyn;
};





list<float> operator*(const list<float> & a,double b)
{
 list<float> wyn(a.count);

 int i;

 for (i=0;(i<a.count);i++)
     wyn[i]=element(a,i)*b;
 return wyn;

};


list<float> operator*(double a,const list<float> & b)
{
 int i;
 list<float> wyn(b.count);

 for (i=0;(i<b.count);i++)
     wyn[i]=element(b,i)*a;
 return wyn;

};

list<float> operator-(const list<float> & a,const list<float> & b)
{
 int i;
 list<float> wyn(min(a.count,b.count));

 for (i=0;(i<a.count) && (i<b.count);i++)
     wyn[i]=element(a,i)-element(b,i);
 return wyn;

};

list<float> operator/(const list<float> & a,double b)
{
 int i;
 list<float> wyn(a.count);

 for (i=0;(i<a.count);i++)
     wyn[i]=element(a,i)/b;
 return wyn;

};


list<list<float> > operator*(const list<float> & a,const list<float> & b)
{

 int i,j;
 list<list<float> > wyn (a.count);
 for (i=0;(i<a.count);i++)
    {
     wyn[i]=b.count;
     (wyn[i])|0;
     for (j=0;j<b.count;j++)
         wyn[i][j]=element(a,i)*element(b,j);
    };
 return wyn;

};

float operator^(const list<float> & a, double arg)
{
 int i;
 float wyn=0;

 for (i=0;(i<a.count) ;i++)
     wyn+=pow(element(a,i),arg);
 return wyn;

};


list<float> operator*(const list<list<float> > & a,const list<float> & b)
{
 int i,j;
 list<float> wyn(a.count);  //tyle kolumn ma a

 for (i=0;(i<a.count);i++)
  {
     wyn[i]=0;
     for (j=0;(i<b.count);i++)
         wyn[i]+=element(a,i)[j]*element(b,j);
  };
 return wyn;

};

list<list<float> > operator+(const list<list<float> > & a,const list<list<float> > & b)
//zaklada sie, ze macierz maprzynajmniej jedna kolumne, ze sa rowne
{

 int i,j;
 list<list<float> > wyn (a.count);
 for (i=0;(i<a.count);i++)
    {
     wyn[i]=element(a,0).count;
     for (j=0;(j<element(a,0).count);i++)
        wyn[i][j]=element(a,i)[j]+element(b,i)[j];
    };
 return wyn;

};


list<list<float> > operator*( double a,const list<list<float> > & b)
//zaklada sie, ze macierz maprzynajmniej jedna kolumne,
{

 int i,j;
 list<list<float> > wyn (b.count);
 for (i=0;(i<b.count);i++)
    {
     wyn[i]=element(b,0).count;
     for (j=0;(j<element(b,0).count);i++)
        wyn[i][j]=a*(element(b,i)[j]);
    };	

 return wyn;

};

list<list<float> > operator*( const list<list<float> > & a, double b)
//zaklada sie, ze macierz maprzynajmniej jedna kolumne,
{

 int i,j;
 list<list<float> > wyn (a.count);
 for (i=0;(i<a.count);i++)
    {
     wyn[i]=element(a,0).count;
     for (j=0;(j<element(a,0).count);i++)
        wyn[i][j]=(element(a,i)[j])*b;
    };    
 return wyn;

};
#ifndef lista_h__

#define lista_h__


//this is an example of a dynamic structure growing as new
//data is provided

//As I symplyfied it before sending it to You, to spare you
//information not important, it is not quite operational; but my aim
//was to send to You the program as simple as possible. 


#include <math.h>  //pow()
#include <stdlib.h>  //malloc()
#include <iostream.h> //istream,ostream
template <class T>
 class list {
 protected:
  T * array;
  int size;   //size of an array
 public:
  int count;   //as size can be grater than a number of objects in an array
             //count counts the real number of them
  T & operator[] (int);
  friend istream & operator>><>(istream &,list<T> &);
    //above was left to show You, that statements symilar to that in line 
    //no. 29 are valid in the compiler I used.
  friend T element <T>(const list<T> &,int);  //but it caused 
             //INTERNAL COMPILER ERROR NO. 9
  list(int);
  ~list();
  
 };






template <class T> istream & operator>>(istream & i,list<T> & l)
{
 int _count=0,t;

 i>>_count;
 l.count=_count;  //initiate count
 for(t=0;t<_count;t++)
  i>>l.array[t];   //zakladamy, ze element tablicy umie sie odczytac

 return i;
};


template <class T> list<T>::list(int n)
{
 count=n;
 size=n+2;
 array=(T*)malloc(size*sizeof(T));
 ostatni=0;
};


template <class T> list<T>::~list()
{
 free(array);
};

template <class T> T & list<T>::operator[] (int nr)
{
 return array[nr];
};

template <class T> T element(const list<T> & l,int nr)
{
 return l.array[nr];
};

#endif
#ifndef list_f_h__

#define list_f_h__

list<float> operator+(const list<float> &,const list<float> &);
list<float> operator-(const list<float> &,const list<float> &);
list<float> operator*(double,const list<float> &);
list<float> operator*(const list<float> &,double);
list<float> operator/(const list<float> & a,double b);
list<list<float> > operator*(const list<float> & ,const list<float> & );
float operator^(const list<float> &, double);
list<float> operator*(const list<list<float> > & ,const list<float> &);
list<list<float> > operator+(const list<list<float> > &,const list<list<float> > &);
list<list<float> > operator*(double ,const list<list<float> > & );
list<list<float> > operator*(const list<list<float> > & ,double);

#endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]