From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59898 invoked by alias); 25 Jul 2018 15:53:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 59848 invoked by uid 89); 25 Jul 2018 15:53:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=bootstrapping, Polacek, polacek 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; Wed, 25 Jul 2018 15:53:41 +0000 Received: from svr-orw-mbx-01.mgc.mentorg.com ([147.34.90.201]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1fiM6d-0000VB-Fx from Cesar_Philippidis@mentor.com ; Wed, 25 Jul 2018 08:53:39 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Wed, 25 Jul 2018 08:53:37 -0700 Subject: Re: [PATCH 1/3] Correct the reported line number in fortran combined OpenACC directives To: Marek Polacek CC: , References: <9787e49d3bb2bc96b16584590090e33b2f4dcce8.1532531520.git.cesar@codesourcery.com> <20180725153208.GA3030@redhat.com> From: Cesar Philippidis Message-ID: <53a0410a-69e7-da7f-2cbc-ad2d880cb295@codesourcery.com> Date: Wed, 25 Jul 2018 15:53:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180725153208.GA3030@redhat.com> Content-Type: multipart/mixed; boundary="------------E2E4CEF8081847351D34BAE8" X-SW-Source: 2018-07/txt/msg01554.txt.bz2 --------------E2E4CEF8081847351D34BAE8 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-length: 1930 On 07/25/2018 08:32 AM, Marek Polacek wrote: > On Wed, Jul 25, 2018 at 08:29:17AM -0700, Cesar Philippidis wrote: >> The fortran FE incorrectly records the line locations of combined acc >> loop directives when it lowers the construct to gimple. Usually this >> isn't a problem because the fortran FE is able to report problems with >> acc loops itself. However, there will be inaccuracies if the ME tries >> to use those locations. >> >> Note that test cases are inconspicuously absent in this patch. >> However, without this bug fix, -fopt-info-note-omp will report bogus >> line numbers. This code patch will be tested in a later patch in >> this series. >> >> Is this OK for trunk? I bootstrapped and regtested it on x86_64 with >> nvptx offloading. >> >> Thanks, >> Cesar >> >> 2018-XX-YY Cesar Philippidis >> >> gcc/fortran/ >> * trans-openmp.c (gfc_trans_oacc_combined_directive): Set the >> location of combined acc loops. >> >> (cherry picked from gomp-4_0-branch r245653) >> >> diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c >> index f038f4c..e7707d0 100644 >> --- a/gcc/fortran/trans-openmp.c >> +++ b/gcc/fortran/trans-openmp.c >> @@ -3869,6 +3869,7 @@ gfc_trans_oacc_combined_directive (gfc_code *code) >> gfc_omp_clauses construct_clauses, loop_clauses; >> tree stmt, oacc_clauses = NULL_TREE; >> enum tree_code construct_code; >> + location_t loc = input_location; >> >> switch (code->op) >> { >> @@ -3930,12 +3931,16 @@ gfc_trans_oacc_combined_directive (gfc_code *code) >> else >> pushlevel (); >> stmt = gfc_trans_omp_do (code, EXEC_OACC_LOOP, pblock, &loop_clauses, NULL); >> + >> + if (CAN_HAVE_LOCATION_P (stmt)) >> + SET_EXPR_LOCATION (stmt, loc); > > This is protected_set_expr_location. Neat, thanks! This patch includes that correction. Is it ok for trunk after bootstrapping and regression testing? Thanks, Cesar --------------E2E4CEF8081847351D34BAE8 Content-Type: text/x-patch; name="0001-Correct-the-reported-line-number-in-fortran-combined.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Correct-the-reported-line-number-in-fortran-combined.pa"; filename*1="tch" Content-length: 1403 2018-XX-YY Cesar Philippidis gcc/fortran/ * trans-openmp.c (gfc_trans_oacc_combined_directive): Set the location of combined acc loops. (cherry picked from gomp-4_0-branch r245653) --- gcc/fortran/trans-openmp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index f038f4c5bf8..b549c682533 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -3869,6 +3869,7 @@ gfc_trans_oacc_combined_directive (gfc_code *code) gfc_omp_clauses construct_clauses, loop_clauses; tree stmt, oacc_clauses = NULL_TREE; enum tree_code construct_code; + location_t loc = input_location; switch (code->op) { @@ -3929,13 +3930,16 @@ gfc_trans_oacc_combined_directive (gfc_code *code) pblock = █ else pushlevel (); + stmt = gfc_trans_omp_do (code, EXEC_OACC_LOOP, pblock, &loop_clauses, NULL); + protected_set_expr_location (stmt, loc); + if (TREE_CODE (stmt) != BIND_EXPR) stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0)); else poplevel (0, 0); - stmt = build2_loc (input_location, construct_code, void_type_node, stmt, - oacc_clauses); + + stmt = build2_loc (loc, construct_code, void_type_node, stmt, oacc_clauses); gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); } -- 2.17.1 --------------E2E4CEF8081847351D34BAE8--