From patchwork Wed Aug 17 00:58:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 659861 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3sDW7z17cxz9t1F for ; Wed, 17 Aug 2016 10:58:53 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=OnP+PTwj; dkim-atps=neutral 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:subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=TPd Sk85CxDhuWs50AUXVgc27kp3m4rP3tparG57ybXvqlBJAsFKVImPOYDBsBeXU+z7 rPt2/idt3Ln2OQmDfJOIQWgq8xZtxdFrZ3NdTfTY2UbR1dfmjorTvBhaB4kMBV/W GbEqVFsmPAgw6mfilXcDL/bCI79zw0WGefgrkaec= 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:subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=QrxX/ObXG q+ahayd5TIuls05U9U=; b=OnP+PTwjSokBPnz3AezcnCOsUAI8k9Ry+BJh3G8Pt LztDYLODjVA0Q22GmuwNKONaELUUXMzVII+ikCgBNfuXIjOxKf7KeTyZhE0jjvTb aM5rmG/44lACVPY+3eG0/KtbIMDsHyjsU19krOulMQaIAJte7uK3d07ioKzbVyzj eo= Received: (qmail 9607 invoked by alias); 17 Aug 2016 00:58:45 -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 9582 invoked by uid 89); 17 Aug 2016 00:58:44 -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 autolearn=ham version=3.3.2 spammy=2016-08-17, *str, incorporate, unblock 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, 17 Aug 2016 00:58:34 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1bZpBf-0002iw-Aw from Thomas_Schwinge@mentor.com for gcc-patches@gcc.gnu.org; Tue, 16 Aug 2016 17:58:31 -0700 Received: from hertz.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Wed, 17 Aug 2016 01:58:29 +0100 From: Thomas Schwinge To: Subject: Re: Use correct location information for OpenACC shape and simple clauses in C/C++ In-Reply-To: <87twfbjejm.fsf@hertz.schwinge.homeip.net> References: <87twfbjejm.fsf@hertz.schwinge.homeip.net> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Wed, 17 Aug 2016 02:58:18 +0200 Message-ID: <87d1l8gqj9.fsf@hertz.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Wed, 27 Jul 2016 17:17:49 +0200, I wrote: > I found that for a lot of OpenACC (and potentially also OpenMP) clauses > (in C/C++ front ends; didn't look at Fortran), we use wrong location > information. The problem is [...] Haven't been able yet to allocate the time to incorporate David's (testsuite) and Jeff's (further cleanup) suggestions (thanks!); to unblock other work, for now committed in r239519 to gomp-4_0-branch as follows: commit fbe4b73c962dc88dae4318474711cd2ea48341fe Author: tschwinge Date: Wed Aug 17 00:54:39 2016 +0000 Use correct location information for OpenACC shape and simple clauses in C/C++ gcc/c/ * c-parser.c (c_parser_oacc_shape_clause) (c_parser_oacc_simple_clause): Add loc formal parameter. Adjust all users. gcc/cp/ * parser.c (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust all users. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@239519 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog.gomp | 6 ++++++ gcc/c/c-parser.c | 29 +++++++++++++++-------------- gcc/cp/ChangeLog.gomp | 5 +++++ gcc/cp/parser.c | 12 +++++++----- 4 files changed, 33 insertions(+), 19 deletions(-) Grüße Thomas diff --git gcc/c/ChangeLog.gomp gcc/c/ChangeLog.gomp index a0f6258..d9725b0 100644 --- gcc/c/ChangeLog.gomp +++ gcc/c/ChangeLog.gomp @@ -1,3 +1,9 @@ +2016-08-17 Thomas Schwinge + + * c-parser.c (c_parser_oacc_shape_clause) + (c_parser_oacc_simple_clause): Add loc formal parameter. Adjust + all users. + 2016-08-04 Thomas Schwinge Backport trunk r239128: diff --git gcc/c/c-parser.c gcc/c/c-parser.c index 1293d56..2e38807 100644 --- gcc/c/c-parser.c +++ gcc/c/c-parser.c @@ -11595,12 +11595,12 @@ c_parser_omp_clause_num_workers (c_parser *parser, tree list) */ static tree -c_parser_oacc_shape_clause (c_parser *parser, omp_clause_code kind, +c_parser_oacc_shape_clause (c_parser *parser, location_t loc, + omp_clause_code kind, const char *str, tree list) { const char *id = "num"; tree ops[2] = { NULL_TREE, NULL_TREE }, c; - location_t loc = c_parser_peek_token (parser)->location; if (kind == OMP_CLAUSE_VECTOR) id = "length"; @@ -11730,12 +11730,12 @@ c_parser_oacc_shape_clause (c_parser *parser, omp_clause_code kind, seq */ static tree -c_parser_oacc_simple_clause (c_parser *parser, enum omp_clause_code code, - tree list) +c_parser_oacc_simple_clause (c_parser * /* parser */, location_t loc, + enum omp_clause_code code, tree list) { check_no_duplicate_clause (list, code, omp_clause_code_name[code]); - tree c = build_omp_clause (c_parser_peek_token (parser)->location, code); + tree c = build_omp_clause (loc, code); OMP_CLAUSE_CHAIN (c) = list; return c; @@ -13184,7 +13184,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, c_name = "async"; break; case PRAGMA_OACC_CLAUSE_AUTO: - clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_AUTO, + clauses = c_parser_oacc_simple_clause (parser, here, OMP_CLAUSE_AUTO, clauses); c_name = "auto"; break; @@ -13244,7 +13244,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_GANG: c_name = "gang"; - clauses = c_parser_oacc_shape_clause (parser, OMP_CLAUSE_GANG, + clauses = c_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_GANG, c_name, clauses); break; case PRAGMA_OACC_CLAUSE_HOST: @@ -13256,8 +13256,9 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, c_name = "if"; break; case PRAGMA_OACC_CLAUSE_INDEPENDENT: - clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_INDEPENDENT, - clauses); + clauses = c_parser_oacc_simple_clause (parser, here, + OMP_CLAUSE_INDEPENDENT, + clauses); c_name = "independent"; break; case PRAGMA_OACC_CLAUSE_LINK: @@ -13265,8 +13266,8 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, c_name = "link"; break; case PRAGMA_OACC_CLAUSE_NOHOST: - clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_NOHOST, - clauses); + clauses = c_parser_oacc_simple_clause (parser, here, + OMP_CLAUSE_NOHOST, clauses); c_name = "nohost"; break; case PRAGMA_OACC_CLAUSE_NUM_GANGS: @@ -13306,7 +13307,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, c_name = "reduction"; break; case PRAGMA_OACC_CLAUSE_SEQ: - clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_SEQ, + clauses = c_parser_oacc_simple_clause (parser, here, OMP_CLAUSE_SEQ, clauses); c_name = "seq"; break; @@ -13320,7 +13321,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_VECTOR: c_name = "vector"; - clauses = c_parser_oacc_shape_clause (parser, OMP_CLAUSE_VECTOR, + clauses = c_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_VECTOR, c_name, clauses); break; case PRAGMA_OACC_CLAUSE_VECTOR_LENGTH: @@ -13333,7 +13334,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_WORKER: c_name = "worker"; - clauses = c_parser_oacc_shape_clause (parser, OMP_CLAUSE_WORKER, + clauses = c_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_WORKER, c_name, clauses); break; default: diff --git gcc/cp/ChangeLog.gomp gcc/cp/ChangeLog.gomp index f8e9f3f..feb186a 100644 --- gcc/cp/ChangeLog.gomp +++ gcc/cp/ChangeLog.gomp @@ -1,3 +1,8 @@ +2016-08-17 Thomas Schwinge + + * parser.c (cp_parser_oacc_shape_clause): Add loc formal + parameter. Adjust all users. + 2016-08-04 Thomas Schwinge Backport trunk r239128: diff --git gcc/cp/parser.c gcc/cp/parser.c index a16898d..d3d673b 100644 --- gcc/cp/parser.c +++ gcc/cp/parser.c @@ -30252,13 +30252,13 @@ cp_parser_oacc_single_int_clause (cp_parser *parser, omp_clause_code code, */ static tree -cp_parser_oacc_shape_clause (cp_parser *parser, omp_clause_code kind, +cp_parser_oacc_shape_clause (cp_parser *parser, location_t loc, + omp_clause_code kind, const char *str, tree list) { const char *id = "num"; cp_lexer *lexer = parser->lexer; tree ops[2] = { NULL_TREE, NULL_TREE }, c; - location_t loc = cp_lexer_peek_token (lexer)->location; if (kind == OMP_CLAUSE_VECTOR) id = "length"; @@ -32294,7 +32294,7 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_GANG: c_name = "gang"; - clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_GANG, + clauses = cp_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_GANG, c_name, clauses); break; case PRAGMA_OACC_CLAUSE_HOST: @@ -32377,7 +32377,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_VECTOR: c_name = "vector"; - clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_VECTOR, + clauses = cp_parser_oacc_shape_clause (parser, here, + OMP_CLAUSE_VECTOR, c_name, clauses); break; case PRAGMA_OACC_CLAUSE_VECTOR_LENGTH: @@ -32392,7 +32393,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_WORKER: c_name = "worker"; - clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_WORKER, + clauses = cp_parser_oacc_shape_clause (parser, here, + OMP_CLAUSE_WORKER, c_name, clauses); break; default: