------- Comment #5 from pinskia at gcc dot gnu dot org 2005-10-14 12:19 ------- Reduced testcase for 4.0 at -O0 and 4.1 at -O1: typedef unsigned int size_t; typedef __complex__ double cdouble; template<class value_type, bool simple_copy = true, bool atomic = true> class RefPointer { }; template<typename elt_t> class Vector : public RefPointer<elt_t> { public: typedef elt_t number; static elt_t elt_zero(); const elt_t *pointer() const; }; template <typename t> inline t min(t a, t b) { } template<typename elt_t> class Tensor : public Vector<elt_t> { public: typedef Vector<elt_t> vector; size_t columns(void) const; size_t rows(void) const; }; cdouble trace(const Tensor<cdouble> &t) { const size_t r = t.rows(); const size_t c = t.columns(); cdouble output = t.elt_zero(); const cdouble *data = t.pointer(); for (size_t i = 0, j = min(r,c); j--; i += (r+1)) { output += data[i]; } return output; }
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24362