From: vries Date: Tue, 15 Jan 2019 10:11:16 +0000 (+0000) Subject: [nvptx] Handle assignment to gang-level reduction variable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63130ee336e0dad61d5f44f8ca87669b503228e1;p=thirdparty%2Fgcc.git [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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267934 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 576541e5e3cc..e45150933e09 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 03c0f82f4a2a..23459e1c6f47 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 c279edfe2f36..becfc701ad7b 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 000000000000..05f58a4bddf9 --- /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; +}