From patchwork Tue Jan 15 10:13:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 1025096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-494057-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="d74Ff5W9"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43f5lX38FBz9rxp for ; Tue, 15 Jan 2019 21:13:43 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=okEzZuPXyp9q9gteoHDzSZ3Jad+ysI+kcj4kHDXQa5+dM6AbsN kb1Ij/biRoaRULg3ht6/mZWD3EYVGov5zZIQGJPtKm0L53+JtLkQbeU1kKtjjlDv yZuWuGWl7KilJMtoK0UgohF65wV7L8pszeTf8ppXlBF6BRoAqHwjdbXzA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=f2GYyBH0b6SU8wJpcnpL3j6KDys=; b=d74Ff5W9eIbz8P1KhtBd TM9V/QC0/C55LdqvI8JT+QN6OzFn1oCuyfzGqDUV0juLzsiwXpKkM2tFRDXkoutI UBCuI/MY/OkqCRCM1ITdlAC8IFMeXWs3D+PGbZRTSTeYUHLVfWgSvRuZ1gXmzyeS Dehv8dIgsoajYDE8db5we4A= Received: (qmail 110267 invoked by alias); 15 Jan 2019 10:13:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 110258 invoked by uid 89); 15 Jan 2019 10:13:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Jan 2019 10:13:30 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2AA74AF3C; Tue, 15 Jan 2019 10:13:28 +0000 (UTC) Date: Tue, 15 Jan 2019 11:13:51 +0100 From: Tom de Vries To: gcc-patches@gcc.gnu.org Cc: Thomas Schwinge Subject: [committed][nvptx] Handle assignment to gang-level reduction variable Message-ID: <20190115101350.GA15881@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, this fixes an ICE when handling an assignment to a gang-level reduction variable. Committed to trunk. Thanks, - Tom [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. --- gcc/config/nvptx/nvptx.c | 3 ++- .../gang-reduction-var-assignment.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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/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; +}