home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-25 | 14.2 KB | 1,216 lines |
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!solace.me.uiuc.edu!tiller
- From: tiller@solace.me.uiuc.edu (Mike Tiller)
- Newsgroups: gnu.g++.bug
- Subject: Bug
- Date: 25 Jan 1993 20:47:36 -0500
- Organization: GNUs Not Usenet
- Lines: 1203
- Sender: daemon@cis.ohio-state.edu
- Approved: bug-g++@prep.ai.mit.edu
- Distribution: gnu
- Message-ID: <9301242343.AA16187@solace.me.uiuc.edu>
-
- This dumps core on a sparc-sunos-4.1
-
- # 1 "Element.c"
- # 1 "Element.h" 1
-
-
-
- # 1 "/wren7/tiller/Include/Gen/Array.h" 1
-
-
-
-
-
-
-
-
-
-
- # 1 "/usr/local/gnu/lib/g++-include/stdio.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #pragma interface
-
-
-
-
-
-
-
-
-
-
-
- # 1 "/usr/local/gnu/lib/g++-include/_G_config.h" 1 3
-
-
-
-
-
-
-
- typedef long _G_clock_t;
- typedef short _G_dev_t;
- typedef long _G_fpos_t;
- typedef unsigned short _G_gid_t;
- typedef unsigned long _G_ino_t;
- typedef unsigned short _G_mode_t;
- typedef short _G_nlink_t;
- typedef long _G_off_t;
- typedef int _G_pid_t;
- typedef int _G_ptrdiff_t;
- typedef int _G_sigset_t;
- typedef int _G_size_t;
- typedef long _G_time_t;
- typedef unsigned short _G_uid_t;
- typedef unsigned short _G_wchar_t;
- typedef int _G_ssize_t;
- typedef char* _G_va_list;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 33 "/usr/local/gnu/lib/g++-include/stdio.h" 2 3
-
-
- extern "C" {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 1 "/usr/local/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/include/stdio.h" 1 3
-
-
-
-
-
- extern struct _iobuf {
- int _cnt;
- unsigned char *_ptr;
- unsigned char *_base;
- int _bufsiz;
- short _flag;
- char _file;
- } _iob[];
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- extern struct _iobuf *__hide_fopen ();
- extern struct _iobuf *__hide_fdopen ();
- extern struct _iobuf *__hide_freopen ();
- extern struct _iobuf *__hide_popen ();
- extern struct _iobuf *tmpfile();
- extern long __hide_ftell ();
- extern char *fgets();
- extern char *gets();
- extern char *__hide_sprintf ();
- extern char *ctermid();
- extern char *cuserid();
- extern char *__hide_tempnam ();
- extern char *tmpnam();
-
-
- extern int __hide_printf (char *, ...);
- extern int __hide_fprintf (struct _iobuf *, char *, ...);
-
-
-
-
-
-
- # 69 "/usr/local/gnu/lib/g++-include/stdio.h" 2 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
- extern "C" {
-
- int fclose(struct _iobuf *);
- struct _iobuf * fdopen(int, const char*);
- int fflush(struct _iobuf *);
- int fgetc(struct _iobuf *);
- char* fgets(char*, int, struct _iobuf *);
- struct _iobuf * fopen(const char*, const char*);
- int fprintf(struct _iobuf *, const char* ...);
- int fputc(int, struct _iobuf *);
- int fputs(const char*, struct _iobuf *);
- _G_size_t fread(void*, _G_size_t , _G_size_t , struct _iobuf *);
-
-
-
- struct _iobuf * freopen(const char*, const char*, struct _iobuf *);
-
- int fscanf(struct _iobuf *, const char* ...);
- int fseek(struct _iobuf *, long, int);
- long ftell(struct _iobuf *);
- _G_size_t fwrite(const void*, _G_size_t , _G_size_t , struct _iobuf *);
- char* gets(char*);
- int getw(struct _iobuf *);
- int pclose(struct _iobuf *);
- void perror(const char*);
- struct _iobuf * popen(const char*, const char*);
- int printf(const char* ...);
- int puts(const char*);
- int putw(int, struct _iobuf *);
- int rewind(struct _iobuf *);
- int scanf(const char* ...);
- void setbuf(struct _iobuf *, char*);
- void setbuffer(struct _iobuf *, char*, int);
- int setlinebuf(struct _iobuf *);
- int setvbuf(struct _iobuf *, char*, int, _G_size_t );
- int sscanf(char*, const char* ...);
- struct _iobuf * tmpfile();
- int ungetc(int, struct _iobuf *);
- int vfprintf (...) ;
- int vprintf (...) ;
- char* sprintf (...) ;
- char* vsprintf (...) ;
-
- extern int _filbuf (...) ;
- extern int _flsbuf (...) ;
-
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 11 "/wren7/tiller/Include/Gen/Array.h" 2
-
-
-
- template <class T>
- class Array
- {
- protected:
- T *array;
- int size;
- T Default;
-
- public:
- void SetSize(int s)
- {
- T *temp;
- int i;
-
- if (array == 0 )
- {
- array = new T[s];
- for(i=0;i<s;i++)
- array[i] = Default;
- }
- else
- {
- temp = array;
- array = new T[s];
- for(i=0;i<s;i++)
- if (i<size)
- array[i] = temp[i];
- else
- array[i] = Default;
-
- delete [] temp;
- }
- size = s;
- }
- Array()
- {
- size = 0;
- array = 0 ;
- }
- Array(T *init, int n)
- {
- int i;
- size = 0;
- for(i=1;i<=n;i++)
- operator+=(init[i-1]);
- }
- Array(const T& a)
- {
- size = 0;
- array = 0 ;
- operator+=(a);
- }
- Array(const T& a, const T& b)
- {
- size = 0;
- array = 0 ;
- operator+=(a);
- operator+=(b);
- }
- Array(const T& a, const T& b, const T& c)
- {
- size = 0;
- array = 0 ;
- operator+=(a);
- operator+=(b);
- operator+=(c);
- }
- inline void SetDef(const T& def) { Default = def; }
- Array(const Array &a)
- {
- int i;
-
- size = a.size;
- array = new T[size];
- for(i=0;i<size;i++)
- array[i] = a.array[i];
- Default = a.Default;
- }
- void operator=(const Array &a)
- {
- int i;
-
- size = a.size;
- array = new T[size];
- for(i=0;i<size;i++)
- array[i] = a.array[i];
- Default = a.Default;
- }
- int OutOfRange(int i)
- {
- if (i-1 >= size || i-1 < 0)
- return(1);
- else
- return(0);
- }
- inline int Size() const { return(size); }
- inline T& Elem(int i) {
- if (i-1 >= size)
- SetSize(i);
- return(array[i-1]);
- }
- inline const T& ConstElem(int i) const {
- if (i-1 >= size)
- return(Default);
- return(array[i-1]);
- }
- inline T GetCopy(int i) const
- {
- if (i-1 >= size)
- return(Default);
- return(array[i-1]);
- }
- inline void Append(const T& a)
- {
- SetSize(size+1);
- array[size-1] = a;
- }
- inline T Last()
- {
- return(array[size-1]);
- }
- inline T Remove(int n)
- {
- T ret = Default;
- if (n>size || n<1)
- return(ret);
- else
- {
- T *temp;
- int i, j;
-
- temp = array;
- array = new T[size-1];
- for(i=0,j=0;i<size;i++)
- {
- if (i==n-1)
- {
- ret = temp[i];
- }
- else
- {
- array[j] = temp[i];
- j++;
- }
- }
- delete [] temp;
- size--;
- }
-
- return(ret);
- }
- inline void Append(T *a)
- {
- SetSize(size+1);
- array[size-1] = *a;
- }
-
- inline const T& operator()(int i) const { return(ConstElem(i)); }
- inline T& operator[](int i) { return(Elem(i)); }
-
- inline void operator+=(const T& a)
- {
- SetSize(size+1);
- array[size-1] = a;
- }
- inline T *operator+=(T *a)
- {
- SetSize(size+1);
- array[size-1] = *a;
- return(a);
- }
- inline void Empty()
- {
- delete [] array;
- array = new T[1];
- size = 0;
- }
- inline void Clear()
- {
-
- delete [] array;
- }
- virtual ~Array()
- {
- Clear();
- }
- };
-
-
- # 4 "Element.h" 2
-
- # 1 "/wren7/tiller/Include/Gen/AArray.h" 1
-
-
-
-
-
- # 1 "/wren7/tiller/Include/Gen/Array.h" 1
-
-
-
-
-
-
- # 202 "/wren7/tiller/Include/Gen/Array.h"
-
- # 6 "/wren7/tiller/Include/Gen/AArray.h" 2
-
-
- template <class K, class V>
- class AArray
- {
- private:
- Array<K> key;
- Array<V> value;
- public:
- AArray() { }
- AArray(const AArray &a)
- {
- key = a.key;
- value = a.value;
- }
- AArray operator=(const AArray &a)
- {
- key = a.key;
- value = a.value;
- return(a);
- }
- V& operator[](K index)
- {
- int i;
-
- for(i=1;i<=key.Size();i++)
- {
- if (key[i]==index)
- return(value[i]);
- }
- key+=index;
- value.SetSize(key.Size());
- return(value[key.Size()]);
- }
- int Get(int p, K& k,V& v)
- {
- if (p>=1 && p<=key.Size())
- {
- k = key(p);
- v = value(p);
- return 1;
- }
- return 0;
- }
- void Empty() { key.Empty(); value.Empty(); }
- int Size() { return(key.Size()); }
- void SetDef(V a) { value.SetDef(a); }
- Array<K> Key() { return(key); }
- };
-
-
- # 5 "Element.h" 2
-
- # 1 "/wren7/tiller/Include/Scalar.h" 1
-
-
-
-
-
-
- # 1 "/usr/local/gnu/lib/g++-include/math.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #pragma interface
-
-
-
-
-
-
-
-
-
-
-
- # 64 "/usr/local/gnu/lib/g++-include/math.h" 3
-
- extern "C" {
-
- double acos(double);
- double acosh(double);
- double asin(double);
- double asinh(double);
- double atan(double);
- double atan2(double, double);
- double atanh(double);
- double cbrt(double);
- double ceil(double);
- double copysign(double,double);
- double cos(double);
- double cosh(double);
- double drem(double,double);
- double erf(double);
- double erfc(double);
- double exp(double);
- double expm1(double);
- double fabs(double);
- double finite(double);
- double floor(double);
- double fmod(double, double);
- double frexp(double, int*);
- double gamma(double);
- double hypot(double,double);
- double infnan(int);
-
-
- int isinf(double);
- int isnan(double);
-
- double j0(double);
- double j1(double);
- double jn(int, double);
- double ldexp(double, int);
- double lgamma(double);
- double log(double);
- double log10(double);
- double log1p(double);
- double logb(double);
- double modf(double, double*);
- double pow(double, double);
- double rint(double);
- double scalb(double, int);
- double sin(double);
- double sinh(double);
- double sqrt(double);
- double tan(double);
- double tanh(double);
- double y0(double);
- double y1(double);
- double yn(int, double);
- double exp10(double);
- void sincos(double,double*,double*);
-
- double aint(double);
- double anint(double);
- int irint(double);
- int nint(double);
- }
-
-
-
-
-
-
-
-
- struct libm_exception
- {
- int type;
- char* name;
- double arg1, arg2, retval;
- };
-
-
-
-
-
-
-
-
- extern "C" int matherr(libm_exception*);
-
-
-
- # 1 "/usr/local/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/include/float.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- union __convert_long_double {
- int __convert_long_double_i[4];
- long double __convert_long_double_d;
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 152 "/usr/local/gnu/lib/g++-include/math.h" 2 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 7 "/wren7/tiller/Include/Scalar.h" 2
-
-
-
-
- # 1 "/wren7/tiller/Include/Gen/Array.h" 1
-
-
-
-
-
-
- # 202 "/wren7/tiller/Include/Gen/Array.h"
-
- # 11 "/wren7/tiller/Include/Scalar.h" 2
-
-
- # 1 "/wren7/tiller/Include/adExpr.h" 1
-
-
-
-
-
-
- # 1 "/wren7/tiller/Include/GC.h" 1
-
-
- extern "C" {
- # 1 "/usr/local/gnu/lib/g++-include/stdio.h" 1 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- # 174 "/usr/local/gnu/lib/g++-include/stdio.h" 3
-
- # 4 "/wren7/tiller/Include/GC.h" 2
-
- };
-
-
-
-
-
-
- class GC
- {
- private:
- class GC *GC_next;
- class GC *GC_prev;
- static class GC *head;
- static class GC *tail;
-
- protected:
- int ref_count;
-
- public:
- static int GC_size;
- GC();
- inline void Ref() { ref_count++; }
- inline void UnRef() { ref_count--; }
- inline int AmountOfGarbage() { return(GC_size); }
- static void Clean();
- static void Print();
- GC *RemoveMe();
- ~GC();
- };
-
-
- # 7 "/wren7/tiller/Include/adExpr.h" 2
-
-
- class adExpression : public GC
- {
- private:
- public:
- adExpression() { }
- virtual ~adExpression() { }
- virtual double Value() = 0;
- virtual double D(const class Scalar&) = 0;
- virtual void Print() = 0;
- };
-
- class adConstExpr : public adExpression
- {
- private:
- double v;
- public:
- adConstExpr(double);
- double Value();
- double D(const class Scalar&);
- void Print() { printf(" <([%d] Const %g)> ", ref_count, v); }
- };
-
- class adBinExpr : public adExpression
- {
- protected:
- adExpression *e1, *e2;
- public:
- adBinExpr(const Scalar&, const Scalar&);
- void Print()
- {
- printf(" <([%d] Bin ", ref_count);
- e1->Print();
- e2->Print();
- printf(")> ");
- }
- ~adBinExpr();
- };
-
- class adAddExpr : public adBinExpr
- {
- public:
- adAddExpr(const Scalar&, const Scalar&);
- double Value();
- double D(const class Scalar&);
- };
-
- class adMultExpr : public adBinExpr
- {
- public:
- adMultExpr(const Scalar&, const Scalar&);
- double Value();
- double D(const class Scalar&);
- };
-
- class adSubExpr : public adBinExpr
- {
- public:
- adSubExpr(const Scalar&, const Scalar&);
- double Value();
- double D(const class Scalar&);
- };
-
- class adDivExpr : public adBinExpr
- {
- public:
- adDivExpr(const Scalar&, const Scalar&);
- double Value();
- double D(const class Scalar&);
- };
-
- class adPowExpr : public adExpression
- {
- protected:
- adExpression *b;
- double exp;
- public:
- adPowExpr(const Scalar&, double);
- double Value();
- double D(const class Scalar&);
- void Print()
- {
- printf(" <([%d] Pow ", ref_count);
- b->Print();
- printf(" %g)> ", exp);
- }
- ~adPowExpr();
- };
-
- class adExtExpr : public adExpression
- {
- typedef double (*DF)(const Scalar &, const Scalar &);
- protected:
- adExpression *b;
- DF df;
- public:
- adExtExpr(const Scalar&, DF);
- double Value() { return(b->Value()); }
- double D(const Scalar &e);
- void Print()
- {
- printf(" <([%d] External )> ", ref_count);
- }
- };
-
-
- Scalar operator+(double, const Scalar&);
- Scalar operator+(const Scalar&, double);
- Scalar operator+(const Scalar&, const Scalar&);
-
-
- Scalar operator-(double, const Scalar&);
- Scalar operator-(const Scalar&, double);
- Scalar operator-(const Scalar&, const Scalar&);
-
-
- Scalar operator*(double, const Scalar&);
- Scalar operator*(const Scalar&, double);
- Scalar operator*(const Scalar&, const Scalar&);
-
-
- Scalar operator/(double, const Scalar&);
- Scalar operator/(const Scalar&, double);
- Scalar operator/(const Scalar&, const Scalar&);
-
-
- Scalar pow(const Scalar&, double);
-
-
- # 13 "/wren7/tiller/Include/Scalar.h" 2
-
-
- class Scalar
- {
- private:
- adExpression *p;
-
- public:
- Scalar();
- Scalar(double);
- Scalar(adExpression *);
- Scalar(const Scalar &);
- inline double Value() const
- {
- return(p->Value());
- }
- inline double D(const Scalar& e) const
- {
- return(p->D(e));
- }
- void Print()
- {
- p->Print();
- printf("\n");
- }
- void operator=(double);
- ~Scalar();
- inline operator adExpression*() const { return(p); }
- inline operator double() const { return(p->Value()); }
-
- int operator==(const Scalar &e) { return(e.p==p); }
- void operator+=(const Scalar&);
- void operator-=(const Scalar&);
- void operator*=(const Scalar&);
- void operator/=(const Scalar&);
-
- static Scalar Default();
- static Scalar Invalid();
-
- friend void operator=(Scalar &, const Scalar &);
- friend adExpression;
- friend adConstExpr;
- friend adAddExpr;
- friend adMultExpr;
- };
-
- inline void operator=(Scalar &e, const Scalar &s)
- {
- e.p->UnRef();
- e.p = s.p;
- e.p->Ref();
- }
-
- class ScVector : public Array<Scalar>
- {
- public:
- ScVector() : Array<Scalar>() { }
- ScVector(double *v, int n)
- {
- int i;
-
- for(i=0;i<n;i++)
- Append(Scalar(v[i]));
- }
- int Offset(Scalar& e)
- {
- int i;
-
- for(i=0;i<size;i++)
- if (array[i]==e)
- return(i+1);
- return(-1);
- }
- };
-
- # 114 "/wren7/tiller/Include/Scalar.h"
-
-
-
- # 6 "Element.h" 2
-
-
- typedef AArray<int,Scalar> LocVec;
- typedef AArray<int,LocVec> LocMat;
-
- class Element
- {
- public:
- virtual void Stiff(LocMat&) = 0;
- virtual void Force(LocVec&) = 0;
- };
-
-
- # 1 "Element.c" 2
-
-
-
-
-
-
-
-
-