[Bug middle-end/44069] [4.5/4.6 Regression] optimization bug initializing from cast array
--- Comment #6 from rguenth at gcc dot gnu dot org 2010-05-14 21:16 --- We fold D.1794_14 = D.1795_13 * 4; D.1793_15 = &vals[0][0] + D.1794_14; to &vals[0][D.1795_13] Now we can either avoid doing this kind of foldings or we need to be more careful when analyzing the result in the oracle. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44069
[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 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
[Bug middle-end/44069] [4.5/4.6 Regression] optimization bug initializing from cast array
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Priority|P3 |P2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44069
[Bug middle-end/44069] [4.5/4.6 Regression] optimization bug initializing from cast array
--- Comment #8 from rguenth at gcc dot gnu dot org 2010-05-25 15:50 --- Subject: Bug 44069 Author: rguenth Date: Tue May 25 15:49:34 2010 New Revision: 159824 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159824 Log: 2010-05-25 Richard Guenther PR middle-end/44069 * gimple-fold.c (maybe_fold_stmt_addition): Avoid generating out-of-bounds array accesses. * g++.dg/torture/pr44069.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/torture/pr44069.C Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-fold.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44069