This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/44069] [4.5/4.6 Regression] optimization bug initializing from cast array
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 May 2010 21:28:06 -0000
- Subject: [Bug middle-end/44069] [4.5/4.6 Regression] optimization bug initializing from cast array
- References: <bug-44069-17521@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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