backport: re PR middle-end/80809 (Multi-free error for variable size array used within OpenMP task)
Backported from mainline 2017-05-22 Jakub Jelinek <jakub@redhat.com> PR middle-end/80809 * gimplify.c (omp_add_variable): For GOVD_DEBUG_PRIVATE use GOVD_SHARED rather than GOVD_PRIVATE with it. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Expect GOVD_SHARED rather than GOVD_PRIVATE with GOVD_DEBUG_PRIVATE. * testsuite/libgomp.c/pr80809-1.c: New test. From-SVN: r248487
This commit is contained in:
parent
3528deed9d
commit
e8f1beb231
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
Backported from mainline
|
Backported from mainline
|
||||||
2017-05-22 Jakub Jelinek <jakub@redhat.com>
|
2017-05-22 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR middle-end/80809
|
||||||
|
* gimplify.c (omp_add_variable): For GOVD_DEBUG_PRIVATE use
|
||||||
|
GOVD_SHARED rather than GOVD_PRIVATE with it.
|
||||||
|
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Expect
|
||||||
|
GOVD_SHARED rather than GOVD_PRIVATE with GOVD_DEBUG_PRIVATE.
|
||||||
|
|
||||||
PR middle-end/80853
|
PR middle-end/80853
|
||||||
* omp-low.c (lower_reduction_clauses): Pass OMP_CLAUSE_PRIVATE
|
* omp-low.c (lower_reduction_clauses): Pass OMP_CLAUSE_PRIVATE
|
||||||
|
|
|
@ -6669,7 +6669,7 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags)
|
||||||
of PRIVATE. The sharing would take place via the pointer variable
|
of PRIVATE. The sharing would take place via the pointer variable
|
||||||
which we remapped above. */
|
which we remapped above. */
|
||||||
if (flags & GOVD_SHARED)
|
if (flags & GOVD_SHARED)
|
||||||
flags = GOVD_PRIVATE | GOVD_DEBUG_PRIVATE
|
flags = GOVD_SHARED | GOVD_DEBUG_PRIVATE
|
||||||
| (flags & (GOVD_SEEN | GOVD_EXPLICIT));
|
| (flags & (GOVD_SEEN | GOVD_EXPLICIT));
|
||||||
|
|
||||||
/* We're going to make use of the TYPE_SIZE_UNIT at least in the
|
/* We're going to make use of the TYPE_SIZE_UNIT at least in the
|
||||||
|
@ -8576,7 +8576,7 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
|
||||||
return 0;
|
return 0;
|
||||||
if (flags & GOVD_DEBUG_PRIVATE)
|
if (flags & GOVD_DEBUG_PRIVATE)
|
||||||
{
|
{
|
||||||
gcc_assert ((flags & GOVD_DATA_SHARE_CLASS) == GOVD_PRIVATE);
|
gcc_assert ((flags & GOVD_DATA_SHARE_CLASS) == GOVD_SHARED);
|
||||||
private_debug = true;
|
private_debug = true;
|
||||||
}
|
}
|
||||||
else if (flags & GOVD_MAP)
|
else if (flags & GOVD_MAP)
|
||||||
|
@ -8819,7 +8819,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
|
||||||
{
|
{
|
||||||
gcc_assert ((n->value & GOVD_DEBUG_PRIVATE) == 0
|
gcc_assert ((n->value & GOVD_DEBUG_PRIVATE) == 0
|
||||||
|| ((n->value & GOVD_DATA_SHARE_CLASS)
|
|| ((n->value & GOVD_DATA_SHARE_CLASS)
|
||||||
== GOVD_PRIVATE));
|
== GOVD_SHARED));
|
||||||
OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_PRIVATE);
|
OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_PRIVATE);
|
||||||
OMP_CLAUSE_PRIVATE_DEBUG (c) = 1;
|
OMP_CLAUSE_PRIVATE_DEBUG (c) = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
Backported from mainline
|
Backported from mainline
|
||||||
2017-05-22 Jakub Jelinek <jakub@redhat.com>
|
2017-05-22 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR middle-end/80809
|
||||||
|
* testsuite/libgomp.c/pr80809-1.c: New test.
|
||||||
|
|
||||||
PR middle-end/80853
|
PR middle-end/80853
|
||||||
* testsuite/libgomp.c/pr80853.c: New test.
|
* testsuite/libgomp.c/pr80853.c: New test.
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* PR middle-end/80809 */
|
||||||
|
/* { dg-do run } */
|
||||||
|
|
||||||
|
__attribute__((noinline, noclone)) void
|
||||||
|
foo (int x)
|
||||||
|
{
|
||||||
|
int i, j, v[x], *w[16];
|
||||||
|
for (i = 0; i < x; i++)
|
||||||
|
v[i] = i;
|
||||||
|
#pragma omp parallel
|
||||||
|
#pragma omp single
|
||||||
|
for (i = 0; i < 16; i++)
|
||||||
|
/* Make sure v is implicitly determined shared in task, because it
|
||||||
|
is shared on the parallel. */
|
||||||
|
#pragma omp task private (j)
|
||||||
|
w[i] = v;
|
||||||
|
for (i = 0; i < 16; i++)
|
||||||
|
if (w[i] != v)
|
||||||
|
__builtin_abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
foo (4);
|
||||||
|
foo (27);
|
||||||
|
foo (196);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue