This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
19981122 optimization bug
- To: egcs-bugs at cygnus dot com
- Subject: 19981122 optimization bug
- From: Helmut Jarausch <jarausch at IGPM dot Rwth-Aachen dot DE>
- Date: Fri, 27 Nov 1998 13:58:21 +0100 (CST)
Hello,
with this current version I encounter a strange optimization bug.
Unfortunately the full header file is quite long (150 Kb, might be cut down
to one half)
1st) there were no problems with previous versions
2nd) the bug does not occur if not compiled with -fstrict-aliasing
3rd) the bug does not occur if the statement
// cerr << hex << Q.raw() << endl; // OK if uncommented
is uncommented
How can I help to isolate the bug?
Code when ompiled with -O3 -fstrict-aliasing
#define MAT_VEC_REAL
#define MAT_VEC_COMPLEX
#include "IGPMatrix"
using IGPMatrix::cMatrix;
using IGPMatrix::cMatrix_R;
using IGPMatrix::MatVecMMC;
using IGPMatrix::Complex;
#ifndef __sgi
using IGPMatrix::drand48;
#endif
#define crand48() Complex(drand48(),drand48())
void Init_cMatrix( cMatrix& A )
{ for ( int k= A.cols(); k > 0; k-- )
for ( int i= A.rows(); i > 0; i-- ) A(i,k)= crand48();
}
int Mchk = 0;
void check( cMatrix_R R, const char Msg[] )
{ double err;
cout << "*** Matrix-Check " << ++Mchk << endl << flush;
if ( (err= norm(R)) > 1E-12 )
{ cout << "\n Check " << Msg << " failed err= " <<err
<< flush; abort();
}
}
const int Rows=13, Cols=7;
// void ccheck8( const cMatrix& Q, const cMatrix& R );
void ccheck8( const cMatrix& Q, const cMatrix& R )
{
check(Q+R-Q-R,"mat +-");
// cerr << hex << Q.raw() << endl; // OK if uncommented
check(Q*2-1*Q-Q,"M*d-");
}
main()
{
cMatrix Q(Rows,Cols), R(Rows,Cols);
Init_cMatrix(Q); Init_cMatrix(R);
ccheck8( Q, R ); // fails
return 0;
}
Many thanks for looking into it,
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
Institute of Technology, RWTH Aachen
D 52056 Aachen, Germany