Bug Report

Petter Urkedal petter@matfys.lth.se
Thu Feb 26 07:30:00 GMT 1998


I am very happy about the new GNU compiler, as I have been very anxious
to have some of the features of the current C++ standard.  THANKS!

But there's a bug somewhere...  Here is the BUG REPORT.  I hope it
will help.

Sincerly,
Petter



--- V e r s i o n ---

g++ -v gives

   Reading specs from /usr/lib/gcc-lib/i386-linux/egcs-2.90.23/specs
   gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)


--- I n p u t   F i l e ---

No include files are needed.  I reduced the input file to

---------------------------------------------------------------
struct matrix_s {};
struct tridiagonal_s : virtual public matrix_s {};

template <class T, class Signature>
class matrix {
public:
    int dim() {}
    T operator()(int, int) {}
};

template <class U, class V, class W>
void __operator_times(U& r, matrix_s, V& x, matrix_s, W& y, matrix_s) {
    if(x.dim(1) != y.dim(0))
	throw logic_error("matrix dimensions does not agree");
    r = U(x.dim(0), y.dim(1));
    for(int i = 0; i < x.dim(0); i++)
	for(int j = 0; j < y.dim(1); j++) {
	    double sum = 0.0;
	    for(int k = 0; k < x.dim(1); k++) sum += x(i,k)*y(k,j);
	    r(i,j) = sum;
	}
}

template <class T, class R, class X, class Y>
inline void operator_times(matrix<T, R>& res, matrix<T, X>& x, matrix<T, Y>& y)
    { __operator_times(res, R(), x, X(), y, Y()); };

main() {
    matrix<double, matrix_s> A, C;
    matrix<double, tridiagonal_s> B;
    operator_times(C, A, B);
}
--------------------------------------------------------------


--- C o m p i l a t i o n ----

g++ b1.cc gives

    b1.cc: In function `void operator_times<double, matrix_s, matrix_s, tridiagonal_s>(class matrix<double,matrix_s> &, class matrix<double,matrix_s> &, class matrix<double,tridiagonal_s> &)':
    b1.cc:27: Internal compiler error.
    b1.cc:27: Please submit a full bug report to `egcs-bugs@cygnus.com'.

(Line 27 refers to

    { __operator_times(res, R(), x, X(), y, Y()); };

i.e., INSIDE the function block.)




More information about the Gcc-bugs mailing list