Hi! If C/C++ array section reductions have non-zero (positive) bias, it is implemented by declaring a smaller private array and subtracting the bias from the start of the private array (because valid code may only dereference elements from bias onwards). But, this isn't something that is kosher in C/C++ pointer arithmetics and the alias oracle seems to get upset on that. So, the following patch fixes that by performing the subtraction on integral type instead of p+ -bias.
Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2015-11-20 Jakub Jelinek <ja...@redhat.com> PR middle-end/68221 * omp-low.c (lower_rec_input_clauses): If C/C++ array reduction has non-zero bias, subtract it in integer type instead of pointer plus of negated bias. * testsuite/libgomp.c/reduction-11.c: Remove xfail. * testsuite/libgomp.c/reduction-12.c: Likewise. * testsuite/libgomp.c++/reduction-11.C: Likewise. * testsuite/libgomp.c++/reduction-12.C: Likewise. --- gcc/omp-low.c.jj 2015-11-20 12:56:17.000000000 +0100 +++ gcc/omp-low.c 2015-11-20 13:44:29.080374051 +0100 @@ -4444,11 +4444,13 @@ lower_rec_input_clauses (tree clauses, g if (!integer_zerop (bias)) { - bias = fold_convert_loc (clause_loc, sizetype, bias); - bias = fold_build1_loc (clause_loc, NEGATE_EXPR, - sizetype, bias); - x = fold_build2_loc (clause_loc, POINTER_PLUS_EXPR, - TREE_TYPE (x), x, bias); + bias = fold_convert_loc (clause_loc, pointer_sized_int_node, + bias); + yb = fold_convert_loc (clause_loc, pointer_sized_int_node, + x); + yb = fold_build2_loc (clause_loc, MINUS_EXPR, + pointer_sized_int_node, yb, bias); + x = fold_convert_loc (clause_loc, TREE_TYPE (x), yb); yb = create_tmp_var (ptype, name); gimplify_assign (yb, x, ilist); x = yb; --- libgomp/testsuite/libgomp.c/reduction-11.c.jj 2015-11-05 16:03:53.000000000 +0100 +++ libgomp/testsuite/libgomp.c/reduction-11.c 2015-11-20 13:38:24.448520879 +0100 @@ -1,4 +1,4 @@ -/* { dg-do run { xfail *-*-* } } */ +/* { dg-do run } */ char z[10] = { 0 }; --- libgomp/testsuite/libgomp.c/reduction-12.c.jj 2015-11-05 16:03:53.000000000 +0100 +++ libgomp/testsuite/libgomp.c/reduction-12.c 2015-11-20 13:38:34.565378078 +0100 @@ -1,4 +1,4 @@ -/* { dg-do run { xfail *-*-* } } */ +/* { dg-do run } */ struct A { int t; }; struct B { char t; }; --- libgomp/testsuite/libgomp.c++/reduction-11.C.jj 2015-11-05 16:03:53.000000000 +0100 +++ libgomp/testsuite/libgomp.c++/reduction-11.C 2015-11-20 13:37:53.921951766 +0100 @@ -1,4 +1,4 @@ -// { dg-do run { xfail *-*-* } } +// { dg-do run } char z[10] = { 0 }; --- libgomp/testsuite/libgomp.c++/reduction-12.C.jj 2015-11-05 16:03:53.000000000 +0100 +++ libgomp/testsuite/libgomp.c++/reduction-12.C 2015-11-20 13:38:03.983809741 +0100 @@ -1,4 +1,4 @@ -// { dg-do run { xfail *-*-* } } +// { dg-do run } template <typename T> struct A Jakub