From patchwork Wed Sep 10 10:27:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 387671 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 CF14114003E for ; Wed, 10 Sep 2014 20:27:25 +1000 (EST) 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:mime-version:content-type; q=dns; s=default; b=Szzdkc1kZgnTTQvv50iCPu0Fr2lKIqpJ7qkoR9bF6YVot0uXvB eW35zhnmkQ7DvIbLoPQFOMURfmfdjso1johmCpS47lLTp1vLrQ/WKlxXafgelzch Ge33gHbZUGfY7yIrOBYeK49d8IQ23A3TjHA0TKMBFxOVY/gW7MfQG4J8s= 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:mime-version:content-type; s= default; bh=e+NX3okhis0P39Q3evFKuTI9gp8=; b=OFELF8R9naIPvutDGR2O uiW45qd1oVjxV/ju9OlgnYi7ODn086Mzt/KHF+c69gBhWs1OkIwvxtI0fZoDILP6 ku67hZSFumwcsrBVkuZj3uoBzvaif8fsju5HBnsjQC/9WNkwQ0Q0AaJCFO+YevS1 E7DhWVq9AvspVuH+TnsPA5M= Received: (qmail 20715 invoked by alias); 10 Sep 2014 10:27:19 -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 20704 invoked by uid 89); 10 Sep 2014 10:27:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 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, 10 Sep 2014 10:27:17 +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 1XRf7I-0002rw-W7 from Thomas_Schwinge@mentor.com ; Wed, 10 Sep 2014 03:27:13 -0700 Received: from feldtkeller.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.2.247.3; Wed, 10 Sep 2014 11:27:12 +0100 From: Thomas Schwinge To: Jakub Jelinek CC: , James Norris Subject: [OpenMP] Spurious =?utf-8?Q?=C2=BBset?= but not =?utf-8?Q?used?= =?utf-8?Q?=C2=AB?= warnings when actually used in OpenMP target's array section's lower-bound and length User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Wed, 10 Sep 2014 12:27:07 +0200 Message-ID: <87y4trrcsk.fsf@schwinge.name> MIME-Version: 1.0 Hi! This is similar to what has previously been addressed in , : int f(int A, int B) { int r = 0; extern int *v; int a = 2; int b = 4; int n = 3; v[n] = 0; #pragma omp target map(to: v[a:b]) r |= v[n]; #pragma omp target map(to: v[A:B]) r |= v[n]; return r; } ../../openacc/w.c: In function 'f': ../../openacc/w.c:6:7: warning: variable 'b' set but not used [-Wunused-but-set-variable] int b = 4; ^ ../../openacc/w.c:5:7: warning: variable 'a' set but not used [-Wunused-but-set-variable] int a = 2; ^ ../../openacc/w.c:1:11: warning: parameter 'A' set but not used [-Wunused-but-set-parameter] int f(int A, int B) ^ ../../openacc/w.c:1:18: warning: parameter 'B' set but not used [-Wunused-but-set-parameter] int f(int A, int B) ^ The following patch fixes this for C: How to fix it in C++? In gcc/cp/parser.c:cp_parser_omp_var_list_no_open similar to the C fix, or in gcc/cp/semantics.c:finish_omp_clauses as done for PR51360? I guess the latter is required for C++ templates? This I can't currently test due to . I have not yet tested whether such an issue might also exist for Fortran. Grüße, Thomas diff --git gcc/c/c-parser.c gcc/c/c-parser.c index 3f4a92b..bba6edb 100644 --- gcc/c/c-parser.c +++ gcc/c/c-parser.c @@ -9887,7 +9887,10 @@ c_parser_omp_variable_list (c_parser *parser, c_parser_consume_token (parser); if (!c_parser_next_token_is (parser, CPP_COLON)) - low_bound = c_parser_expression (parser).value; + { + low_bound = c_parser_expression (parser).value; + mark_exp_read (low_bound); + } if (c_parser_next_token_is (parser, CPP_CLOSE_SQUARE)) length = integer_one_node; else @@ -9900,7 +9903,10 @@ c_parser_omp_variable_list (c_parser *parser, break; } if (!c_parser_next_token_is (parser, CPP_CLOSE_SQUARE)) - length = c_parser_expression (parser).value; + { + length = c_parser_expression (parser).value; + mark_exp_read (length); + } } /* Look for the closing `]'. */ if (!c_parser_require (parser, CPP_CLOSE_SQUARE,