This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/44069] [4.5/4.6 Regression] optimization bug initializing from cast array



------- Comment #7 from rguenth at gcc dot gnu dot org  2010-05-14 21:28 -------
More reduced testcase:

template <unsigned R, unsigned C>
class M {
public:
    M(const int* arr) {
        for (unsigned long r = 0; r < R; ++r)
          for (unsigned long c = 0; c < C; ++c)
            m[r*C+c] = arr[r*C+c];
    }
    int operator()(unsigned r, unsigned c) const
      { return m[r*C+c]; }
private:
    int m[R*C];
};
extern "C" void abort (void);
int main()
{
  int vals[2][2] = { { 1, 2 }, { 5, 6 } };
  M<2,2> m( &(vals[0][0]) );
  if (m(1,0) != 5)
    abort ();
  return 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44069


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]