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