From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117375 invoked by alias); 27 Jan 2017 15:03:04 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 117325 invoked by uid 89); 27 Jan 2017 15:03:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=*code, openmp.c, Cesar, UD:openmp.c X-Spam-User: qpsmtpd, 2 recipients X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Jan 2017 15:02:51 +0000 Received: from svr-orw-mbx-04.mgc.mentorg.com ([147.34.90.204]) by relay1.mentorg.com with esmtp id 1cX836-0005jp-TK from Cesar_Philippidis@mentor.com ; Fri, 27 Jan 2017 07:02:48 -0800 Received: from [127.0.0.1] (147.34.91.1) by SVR-ORW-MBX-04.mgc.mentorg.com (147.34.90.204) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 27 Jan 2017 07:02:46 -0800 To: "gcc-patches@gcc.gnu.org" , Fortran List From: Cesar Philippidis Subject: [gomp4] don't error on implicitly private induction variables in gfortran Message-ID: Date: Fri, 27 Jan 2017 15:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------6578DE857D33D227C7AF8FFA" X-ClientProxiedBy: svr-orw-mbx-02.mgc.mentorg.com (147.34.90.202) To SVR-ORW-MBX-04.mgc.mentorg.com (147.34.90.204) X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00098.txt.bz2 --------------6578DE857D33D227C7AF8FFA Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-length: 225 While experimenting with some new OpenACC benchmarks, I noticed that gfortran errors when the user explicitly marks loop induction variables as private. I applied this patch to gomp-4_0-branch to resolve that problem. Cesar --------------6578DE857D33D227C7AF8FFA Content-Type: text/x-patch; name="gomp4-gfc-implifictly-private.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gomp4-gfc-implifictly-private.diff" Content-length: 1461 2017-01-26 Cesar Philippidis gcc/fortran/ * openmp.c (gfc_resolve_oacc_blocks): Populate list of private variables. gcc/testsuite/ * gfortran.dg/goacc/implicitly-private.f90: New test. diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 61940d7..2782a8d 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -5192,7 +5192,8 @@ gfc_resolve_oacc_blocks (gfc_code *code, gfc_namespace *ns) { fortran_omp_context ctx; oacc_function dims = OACC_FUNCTION_NONE; - + gfc_omp_namelist *n; + resolve_oacc_loop_blocks (code); ctx.code = code; @@ -5217,6 +5218,10 @@ gfc_resolve_oacc_blocks (gfc_code *code, gfc_namespace *ns) ctx.dims = dims; omp_current_ctx = &ctx; + if (code->ext.omp_clauses) + for (n = code->ext.omp_clauses->lists[OMP_LIST_PRIVATE]; n; n = n->next) + ctx.private_iterators->add (n->sym); + gfc_resolve_blocks (code->block, ns); omp_current_ctx = ctx.previous; diff --git a/gcc/testsuite/gfortran.dg/goacc/implicitly-private.f90 b/gcc/testsuite/gfortran.dg/goacc/implicitly-private.f90 new file mode 100644 index 0000000..a687d8a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/implicitly-private.f90 @@ -0,0 +1,12 @@ +! Ensure that implicitly private variables do not clash with those +! that are explicitly private. + +program main + implicit none + + integer i + + !$acc parallel loop private(i) + do i = 1, 100 + end do +end program main --------------6578DE857D33D227C7AF8FFA--