re PR c++/81130 (ICE OpenMP shared clause in gimplify_var_or_parm_decl, at gimplify.c:2584)
PR c++/81130 * gimplify.c (omp_add_variable): Don't force GOVD_SEEN for types with ctors/dtors if GOVD_SHARED is set. * testsuite/libgomp.c++/pr81130.C: New test. From-SVN: r249482
This commit is contained in:
parent
67d4a7232c
commit
8887fa1078
@ -1,5 +1,9 @@
|
|||||||
2017-06-21 Jakub Jelinek <jakub@redhat.com>
|
2017-06-21 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR c++/81130
|
||||||
|
* gimplify.c (omp_add_variable): Don't force GOVD_SEEN for types
|
||||||
|
with ctors/dtors if GOVD_SHARED is set.
|
||||||
|
|
||||||
Backported from mainline
|
Backported from mainline
|
||||||
2017-06-20 Jakub Jelinek <jakub@redhat.com>
|
2017-06-20 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
@ -6608,9 +6608,11 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Never elide decls whose type has TREE_ADDRESSABLE set. This means
|
/* Never elide decls whose type has TREE_ADDRESSABLE set. This means
|
||||||
there are constructors involved somewhere. */
|
there are constructors involved somewhere. Exception is a shared clause,
|
||||||
if (TREE_ADDRESSABLE (TREE_TYPE (decl))
|
there is nothing privatized in that case. */
|
||||||
|| TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
|
if ((flags & GOVD_SHARED) == 0
|
||||||
|
&& (TREE_ADDRESSABLE (TREE_TYPE (decl))
|
||||||
|
|| TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))))
|
||||||
flags |= GOVD_SEEN;
|
flags |= GOVD_SEEN;
|
||||||
|
|
||||||
n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
|
n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2017-06-21 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR c++/81130
|
||||||
|
* testsuite/libgomp.c++/pr81130.C: New test.
|
||||||
|
|
||||||
2017-06-02 Jakub Jelinek <jakub@redhat.com>
|
2017-06-02 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
Backported from mainline
|
Backported from mainline
|
||||||
|
41
libgomp/testsuite/libgomp.c++/pr81130.C
Normal file
41
libgomp/testsuite/libgomp.c++/pr81130.C
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// PR c++/81130
|
||||||
|
// { dg-do run }
|
||||||
|
|
||||||
|
struct A
|
||||||
|
{
|
||||||
|
A ();
|
||||||
|
~A ();
|
||||||
|
int a;
|
||||||
|
};
|
||||||
|
|
||||||
|
A::A ()
|
||||||
|
{
|
||||||
|
a = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
A::~A ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
struct B
|
||||||
|
{
|
||||||
|
A b;
|
||||||
|
int c;
|
||||||
|
B () : c (1)
|
||||||
|
{
|
||||||
|
#pragma omp parallel shared (b, c) num_threads (2)
|
||||||
|
#pragma omp master
|
||||||
|
{
|
||||||
|
b.a++;
|
||||||
|
c += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
B v;
|
||||||
|
if (v.b.a != 1 || v.c != 3)
|
||||||
|
__builtin_abort ();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user