From d41d952c9bbdffe6fd2badc9c4f2c18d241ce412 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 15 Jan 2019 10:11:16 +0000 Subject: [PATCH] [nvptx] Handle assignment to gang-level reduction variable 2019-01-15 Tom de Vries PR target/80547 * config/nvptx/nvptx.c (nvptx_goacc_reduction_init): Handle lhs == NULL_TREE for gang-level reduction. * testsuite/libgomp.oacc-c-c++-common/gang-reduction-var-assignment.c: New test. From-SVN: r267934 --- gcc/ChangeLog | 6 ++++++ gcc/config/nvptx/nvptx.c | 3 ++- libgomp/ChangeLog | 6 ++++++ .../gang-reduction-var-assignment.c | 16 ++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/gang-reduction-var-assignment.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 576541e5e3c..e45150933e0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-01-15 Tom de Vries + + PR target/80547 + * config/nvptx/nvptx.c (nvptx_goacc_reduction_init): Handle + lhs == NULL_TREE for gang-level reduction. + 2019-01-15 Richard Biener Prathamesh Kulkarni diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 03c0f82f4a2..23459e1c6f4 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -6242,7 +6242,8 @@ nvptx_goacc_reduction_init (gcall *call, offload_attrs *oa) init = var; } - gimplify_assign (lhs, init, &seq); + if (lhs != NULL_TREE) + gimplify_assign (lhs, init, &seq); } pop_gimplify_context (NULL); diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index c279edfe2f3..becfc701ad7 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2019-01-15 Tom de Vries + + PR target/80547 + * testsuite/libgomp.oacc-c-c++-common/gang-reduction-var-assignment.c: + New test. + 2019-01-12 Tom de Vries * testsuite/libgomp.oacc-c-c++-common/pr85486-2.c: New test. diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/gang-reduction-var-assignment.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/gang-reduction-var-assignment.c new file mode 100644 index 00000000000..05f58a4bddf --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/gang-reduction-var-assignment.c @@ -0,0 +1,16 @@ +/* { dg-xfail-run-if "PR88852" { openacc_host_selected } } */ + +int +main (void) +{ + int x = 123; + +#pragma acc parallel num_gangs(1) reduction (+: x) + { + x = 23; + } + if (x != 146) + __builtin_abort(); + + return 0; +} -- 2.30.2