From patchwork Mon Nov 8 02:59:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 70389 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]) by ozlabs.org (Postfix) with SMTP id 3F311B6EF0 for ; Mon, 8 Nov 2010 14:00:12 +1100 (EST) Received: (qmail 23503 invoked by alias); 8 Nov 2010 03:00:02 -0000 Received: (qmail 23403 invoked by uid 22791); 8 Nov 2010 03:00:00 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from out01.roch.ny.frontiernet.net (HELO out01.roch.ny.frontiernet.net) (66.133.183.226) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Nov 2010 02:59:56 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAAf21kxHc96u/2dsb2JhbACiBbpHhUgEhFg Received: from relay02.roch.ny.frontiernet.net ([66.133.182.165]) by out01.roch.ny.frontiernet.net with ESMTP; 08 Nov 2010 02:59:54 +0000 X-Previous-IP: 71.115.222.174 Received: from quava.localdomain (pool-71-115-222-174.spknwa.dsl-w.verizon.net [71.115.222.174]) by relay02.roch.ny.frontiernet.net (Postfix) with ESMTPA id 2010A10F99E; Mon, 8 Nov 2010 02:59:51 +0000 (UTC) Message-ID: <4CD76788.5040104@frontier.com> Date: Sun, 07 Nov 2010 18:59:20 -0800 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.1.6-1.fc13 Thunderbird/3.1.6 MIME-Version: 1.0 To: gfortran CC: gcc patches Subject: [patch, fortran] PR43899 Wrong unused-variable warning with NAMELISTs 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 Hi, This patch avoids the bogus warning. Still remaining is to check if a namelist is not used somewhere. I assume we need to scan a namespace. I would like to get this part committed before the last piece. Regression tested on x86-64. OK for trunk? Regards, Jerry 2010-11-07 Jerry DeLisle PR fortran/43899 * trans-decl.c (generate_local_decl): Do not generate unused warning for variables in namelists. Index: trans-decl.c =================================================================== --- trans-decl.c (revision 166426) +++ trans-decl.c (working copy) @@ -4017,9 +4017,10 @@ generate_local_decl (gfc_symbol * sym) } /* Warn for unused variables, but not if they're inside a common - block or are use-associated. */ + block, a namelist, or are use-associated. */ else if (warn_unused_variable - && !(sym->attr.in_common || sym->attr.use_assoc || sym->mark)) + && !(sym->attr.in_common || sym->attr.use_assoc || sym->mark + || sym->attr.in_namelist)) gfc_warning ("Unused variable '%s' declared at %L", sym->name, &sym->declared_at);