Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!cica!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!flute.cs.uiuc.edu!grunwald From: grunwald@flute.cs.uiuc.edu (Dirk Grunwald) Newsgroups: gnu.g++.bug Subject: optimization missed Message-ID: Date: 26 Jul 89 15:35:09 GMT Sender: news@brutus.cs.uiuc.edu Reply-To: grunwald@flute.cs.uiuc.edu Distribution: gnu Organization: University of Illinois, Urbana-Champaign Lines: 67 g++-1.35.1+, sun3/os4, -m68881 G++ doesn't notice that the variable `stride' is an induction variable in the following code; stride is a private member variable. It is not modified anywhere but at the beginning of the loop. It should qualify as an induction variable, but I don't think it's being considered for this. //--------------- C++ header to handle arrays like fortran. class Matrix { // by dave nichols private: int *index; double *data; int stride; public: Matrix( int n1, int n2, int *indx, double *dat); double& operator()( int i, int j ); }; static inline double& Matrix::operator()( int i, int j ) { return ( data[i + j * stride ] ); } static inline Matrix::Matrix( int n1, int n2, int *indx, double *dat) { index = indx; data = dat; // for( int i =0; i #include #include #define MATRIX(name,n1,n2)\ int name2(name,index)[n1];\ double name2(name,data)[n1*n2]; \ Matrix name(n1, n2, name2(name,index), name2(name,data)); main () { int i, j, k; static const int n=200; MATRIX(x,n,n); double total=0.; for( i=0; i