From: Richard Biener Date: Mon, 19 Sep 2016 06:55:17 +0000 (+0000) Subject: re PR tree-optimization/77605 (wrong code at -O3 on x86_64-linux-gnu) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ae5276392fb59dbdec56dd8cc6cc8253d9334c8b;p=gcc.git re PR tree-optimization/77605 (wrong code at -O3 on x86_64-linux-gnu) 2016-09-19 Richard Biener PR middle-end/77605 * tree-data-ref.c (analyze_subscript_affine_affine): Use the proper niter to bound the loops. * gcc.dg/torture/pr77605.c: New testcase. From-SVN: r240227 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e48f8448824..e29c212303a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-09-19 Richard Biener + + PR middle-end/77605 + * tree-data-ref.c (analyze_subscript_affine_affine): Use the + proper niter to bound the loops. + 2016-09-19 Richard Biener PR tree-optimization/77514 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5ea3ac554d4..1077e173e92 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-19 Richard Biener + + PR middle-end/77605 + * gcc.dg/torture/pr77605.c: New testcase. + 2016-09-18 Louis Krupp * gfortran.dg/pr68078.f90: XFAIL run on Darwin diff --git a/gcc/testsuite/gcc.dg/torture/pr77605.c b/gcc/testsuite/gcc.dg/torture/pr77605.c new file mode 100644 index 00000000000..3f1a26bc8d5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77605.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +int a, b, c[2][8]; + +int main () +{ + for (a = 0; a < 8; a++) + for (b = 0; b < 2; b++) + c[b][a] = c[b][b + 6] ^ 1; + + if (c[0][7] != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 58da248040f..8152da3f180 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -2686,13 +2686,13 @@ analyze_subscript_affine_affine (tree chrec_a, if (niter > 0) { - HOST_WIDE_INT tau2 = MIN (FLOOR_DIV (niter - i0, i1), - FLOOR_DIV (niter - j0, j1)); + HOST_WIDE_INT tau2 = MIN (FLOOR_DIV (niter_a - i0, i1), + FLOOR_DIV (niter_b - j0, j1)); HOST_WIDE_INT last_conflict = tau2 - (x1 - i0)/i1; /* If the overlap occurs outside of the bounds of the loop, there is no dependence. */ - if (x1 >= niter || y1 >= niter) + if (x1 >= niter_a || y1 >= niter_b) { *overlaps_a = conflict_fn_no_dependence (); *overlaps_b = conflict_fn_no_dependence ();