From patchwork Mon Dec 9 15:58:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frederik Harwath X-Patchwork-Id: 1206386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515532-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="FVUxUGm7"; 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 47Wnth3rKZz9sNH for ; Tue, 10 Dec 2019 02:59:06 +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 :subject:to:references:from:cc:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=hecuCrQ7fR2Sfholw JlaHQ/vFDAR/oA6heFLE8ThBMnLL5GW3ngpvWtRJVuR9hue62KkRiO1ObliPZ60T wT+y45EdWeN6mn3b+V9gupTN1U5Il+wzXBekthPlz7ifGzxKbWpXZCfp/LCBJJqk 64Y/WY4t0Lq3FerviIH/z9dbZE= 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 :subject:to:references:from:cc:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=PQgawiaQpBeP6W+wSqRKY8k ZhDE=; b=FVUxUGm72F8OCjyLhWon5SchmQGSjHr29tR0+CNJ+PDBdpEnceI5mfs kIWn+GHk9cpOln6YA+6eqndrYap8D6+yepetdyNyO64C7tjfEe1jKsLvMgqDT8Xt Omce8hiYn1D7prwRvrZnNbpn/yJTQKW4dxXsb7atkxwS6MVXibkM= Received: (qmail 7199 invoked by alias); 9 Dec 2019 15:58:59 -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 7184 invoked by uid 89); 9 Dec 2019 15:58:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=validity, HX-Languages-Length:2800, H*f:sk:2f70a48, LOCATION_COLUMN X-HELO: esa2.mentor.iphmx.com Received: from esa2.mentor.iphmx.com (HELO esa2.mentor.iphmx.com) (68.232.141.98) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Dec 2019 15:58:57 +0000 IronPort-SDR: l5eYZkedaeq/uhh56VfMGNPWyBK7VxkY1e0Af7JSv3P+f4c2QN8RiUymSAMiftPLGe2+8IYPqI GHYBV0fA8F/krsOGlBJFAaV77Xd4FR4/d9qPOnSTM7g2F9anGSfboYWsKfULs85AoIHe58WaPN 1vgc/X57bSxaZSZRlrndoKgy2hZruDUAgFbAGnIr5WZgBiATg9zBLx//vRRtJJrGhW0DX4Z2UA 62LJyfC0jkiB11I/Ao+JXBZyk5Rf4vFGuKDNqezbmR67wVjeziDGpRFZgWmT994SwzxNIpFR6p ziA= Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 09 Dec 2019 07:58:56 -0800 IronPort-SDR: VkermUlLcoCIOKMbP6azTuo7NljMeIF/X+LSivEoBsNVYneHaG9hZ2H/BPndqdXfGKLD2WsYca MhpW8mZSg5djOlfY0yaKk1XP9Aq9OXjJTntPnVBPzP3nBx7olEr/E9CzO7Gao/vZQXFeZO9oF2 uueuWElJDHoBk/+HPwjDIpxe/w/cZpJ5wOk1Z7vlpr4fTMzhQ1vAwHORKocysM0Q+o80acweNp gYX8wZwuN4wUyYYlsyoK+NURFEDCVaHfExMnShCOPIsfLp8C4GiIH2z2zt+HRtEHHWIBXmKquZ +Y0= Subject: [PATCH] Fix column information for omp_clauses in Fortran code To: Tobias Burnus , gcc-patches , fortran References: <2f70a48d-ba2e-bc37-314b-7758a9ac1e0a@codesourcery.com> From: "Harwath, Frederik" CC: Jakub Jelinek , Thomas Schwinge X-Pep-Version: 2.0 Message-ID: <0624ce85-2ee7-38eb-d115-509d600d3f20@codesourcery.com> Date: Mon, 9 Dec 2019 16:58:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <2f70a48d-ba2e-bc37-314b-7758a9ac1e0a@codesourcery.com> X-IsSubscribed: yes Hi, Tobias has recently fixed a problem with the column information in gfortran locations ("PR 92793 - fix column used for error diagnostic"). Diagnostic messages for OpenMP/OpenACC clauses do not contain the right column information yet. The reason is that the location information of the first clause is used for all clauses on a line and hence the columns are wrong for all but the first clause. The attached patch fixes this problem. I have tested the patch manually by adapting the validity check for nested OpenACC reductions (see omp-low.c) to include the location of clauses in warnings instead of the location of the loop to which the clause belongs. I can add a regression test based on this later on after adapting the code in omp-low.c. Is it ok to include the patch in trunk? Best regards, Frederik On 04.12.19 14:37, Tobias Burnus wrote: > As reported internally by Frederik, gfortran currently passes LOCATION_COLUMN == 0 to the middle end. The reason for that is how parsing works – gfortran reads the input line by line. > > For internal error diagnostic (fortran/error.c), the column location was corrected –  but not for locations passed to the middle end. Hence, the diagnostic there wasn't optimal. > > Fixed by introducing a new function; now one only needs to make sure that no new code will re-introduce "lb->location" :-) > > Build and regtested on x86-64-gnu-linux. > OK for the trunk? > > Tobias From af3a63b64f38d522b0091a123a919d1f20f5a8b1 Mon Sep 17 00:00:00 2001 From: Frederik Harwath Date: Mon, 9 Dec 2019 15:07:53 +0100 Subject: [PATCH] Fix column information for omp_clauses in Fortran code The location of all OpenMP/OpenACC clauses on any given line in Fortran code always points to the first clause on that line. Hence, the column information is wrong for all clauses but the first one. Use the correct location for each clause instead. 2019-12-09 Frederik Harwath /gcc/fortran/ * trans-openmp (gfc_trans_omp_reduction_list): Pass correct location for each clause to build_omp_clause. --- gcc/fortran/trans-openmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index d07ff86fc0b..356fd04e6c3 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -1982,7 +1982,7 @@ gfc_trans_omp_reduction_list (gfc_omp_namelist *namelist, tree list, tree t = gfc_trans_omp_variable (namelist->sym, false); if (t != error_mark_node) { - tree node = build_omp_clause (gfc_get_location (&where), + tree node = build_omp_clause (gfc_get_location (&namelist->where), OMP_CLAUSE_REDUCTION); OMP_CLAUSE_DECL (node) = t; if (mark_addressable) -- 2.17.1 From patchwork Tue Dec 10 14:23:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederik Harwath X-Patchwork-Id: 1207114 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515607-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="BMR1DI1I"; 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 47XMkV5bv8z9sRH for ; Wed, 11 Dec 2019 01:24:02 +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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=a8c082R1+3z6nO4v ZjftyxUNEK+KCRQy0HeaTeb3zCmCvTXa67I+6CYtW/L3YDnU2QN4hSpNzxCJWYXU /J10cexOjIlu3MdR9QL9oxWaZp97HJMskuURHLFxKoZKRS5idmN14zwv8BoIxlUX wcswmPkfyVE6GyxA0YqBYtruzd4= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=08prgPYLUGeAbw1Ex4YoIY xEdB0=; b=BMR1DI1ISawpGpYjkX0oqVRIMFDmgMLbrxjIUkx+WV83fY4ngCP6PI GxHCvspnx75rqHm1R8T+ue4XQW3SAp6sxiFnTjmp6tJ/R8eHo1ALAsFoYaWWlZ6d XfFzIk+i/cpij46uEbsW9hMlqfu5YlGxZExl7R0HIsDWuzHtzwNLE= Received: (qmail 81504 invoked by alias); 10 Dec 2019 14:23:39 -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 81443 invoked by uid 89); 10 Dec 2019 14:23:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=communicated X-HELO: esa1.mentor.iphmx.com Received: from esa1.mentor.iphmx.com (HELO esa1.mentor.iphmx.com) (68.232.129.153) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Dec 2019 14:23:37 +0000 IronPort-SDR: UQ7sh1QkxB4FraFyKUlYwYEPfu6VjEzLCF0g1B8Glx4qyKwGuho73VrBTQtfmI9jPU0yWd41r7 04PB+Iss89WLo+ll5/xCVCnavpsJWKejPq5JxlA4DUQK73xTJxohcD544ae7EahHrZbqWrxWGZ C77J/nfvikWAOoPsnJ0m2clpNXkC7ohAy4xTirKXmoGr6hjLCLaBQv+6kD7PwX6FK2wAH50wbx Nb/jqAhS7qt3u9qP5uuG5jCDRHEx9Kr+8D/etwhAjnEGNW3TOHUF46MOlyQkLtc3FXRqChZKQN /U4= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 10 Dec 2019 06:23:37 -0800 IronPort-SDR: QDVKUhj7JIN6nOJ02bHPYrxAx13WDC4keQyQyAbg7hRERmGEcxXWB8W6wHm2fWcDjLBeHZMsjx Y2u+IIgZgaOo7SI+WN3yJBt7y4iN6aoVymC/sSU8z9uQS7crBKHGAp3k+WfYE/G51BvNpHwJN9 /wWuELMl7a6YhMPZ9iew1Nfh3CIzNIDDXoRGWRjkApxrIxQYX6TqkUFQAOkgOeTmDnGS8fcjMV 4oZcJAC+rrxVVE9fFiKJSzUmZAflvp7s5ORp4b1X6rlwqhExA2E6bB/e0TeilkVvdB5KmX/Sd7 fiM= From: Frederik Harwath To: , , CC: Subject: [PATCH 2/2] Add tests to verify OpenACC clause locations Date: Tue, 10 Dec 2019 15:23:03 +0100 Message-ID: <20191210142303.9948-3-frederik@codesourcery.com> In-Reply-To: <0624ce85-2ee7-38eb-d115-509d600d3f20@codesourcery.com> References: <0624ce85-2ee7-38eb-d115-509d600d3f20@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes Check that the column information for OpenACC clauses is communicated correctly to the middle-end, in particular by the Fortran front-end (cf. PR 92793). 2019-12-10 Frederik Harwath gcc/testsuite/ * gcc.dg/goacc/clause-locations.c: New test. * gfortran.dg/goacc/clause-locations.f90: New test. --- gcc/testsuite/gcc.dg/goacc/clause-locations.c | 17 +++++++++++++++++ .../gfortran.dg/goacc/clause-locations.f90 | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/goacc/clause-locations.c create mode 100644 gcc/testsuite/gfortran.dg/goacc/clause-locations.f90 diff --git a/gcc/testsuite/gcc.dg/goacc/clause-locations.c b/gcc/testsuite/gcc.dg/goacc/clause-locations.c new file mode 100644 index 00000000000..51184e3517b --- /dev/null +++ b/gcc/testsuite/gcc.dg/goacc/clause-locations.c @@ -0,0 +1,17 @@ +/* Verify that the location information for clauses is correct. */ + +void +check_clause_columns() { + int i, j, sum, diff; + + #pragma acc parallel + { + #pragma acc loop reduction(+:sum) + for (i = 1; i <= 10; i++) + { + #pragma acc loop reduction(-:diff) reduction(-:sum) /* { dg-warning "53: conflicting reduction operations for .sum." } */ + for (j = 1; j <= 10; j++) + sum = 1; + } + } +} diff --git a/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90 b/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90 new file mode 100644 index 00000000000..29798d31542 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90 @@ -0,0 +1,18 @@ +! Verify that the location information for clauses is correct. +! See also PR 92793. + +subroutine check_clause_columns () + implicit none (type, external) + integer :: i, j, sum, diff + + !$acc parallel + !$acc loop reduction(+:sum) + do i = 1, 10 + !$acc loop reduction(-:diff) reduction(-:sum) ! { dg-warning "47: conflicting reduction operations for .sum." } + do j = 1, 10 + sum = 1 + end do + end do + !$acc end parallel +end subroutine check_clause_columns +