From patchwork Fri Jul 12 21:07:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 258803 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 29F3F2C02CD for ; Sat, 13 Jul 2013 07:07:29 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=Mso3eHwIGhBEBSslMJYSUYTo63TzhbaOI54P6p1AWBauMg D54Q3wPtXjo0VRehBzvgbaAOlLBePEpcTeaRnxXH9inXX3/wArHLd0cK8i+oDASg q4P6Bx+EGamS4SURWUKANzccsYsn/AiC5z2r3U5ZwSJf4IW8docI6qXX+PMkE= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=6W1xxWVVykU2t6YVfbFVlWLgBT4=; b=JKqTOsUXKPlOjdvNM5wg sH5t9PL4nAJ9lD9hb+S0M4eMp6bY6AZ7vqT8KV2jn4OdkAQV/8PcSX5dR6ULieML TDnz5lkYq/1OkMs4BZqZVD+96u1BmR9+9LSxUvvaFpBfT7b61z6IpBwQxXYJw/lv 25talVU4Fj5QdHXoCaHzlYk= Received: (qmail 16228 invoked by alias); 12 Jul 2013 21:07:23 -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 16211 invoked by uid 89); 12 Jul 2013 21:07:22 -0000 X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_20, RDNS_NONE, URIBL_BLOCKED autolearn=no version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from Unknown (HELO cc-smtpout3.netcologne.de) (89.1.8.213) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 12 Jul 2013 21:07:20 +0000 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id C51BD12051; Fri, 12 Jul 2013 23:07:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id BBB0F11DEA; Fri, 12 Jul 2013 23:07:12 +0200 (CEST) Received: from [78.35.174.138] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.0.0) (envelope-from ) id 51e07000-053f-7f0000012729-7f000001b9f8-1 for ; Fri, 12 Jul 2013 23:07:12 +0200 Received: from [192.168.0.110] (xdsl-78-35-174-138.netcologne.de [78.35.174.138]) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Fri, 12 Jul 2013 23:07:11 +0200 (CEST) Message-ID: <51E06FFE.4070606@netcologne.de> Date: Fri, 12 Jul 2013 23:07:10 +0200 From: Thomas Koenig User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: "fortran@gcc.gnu.org" , gcc-patches Subject: [patch, fortran] PR 52669, warn about unused PRIVATE module variables X-Virus-Found: No Hello world, here is a rather self-evident patch for PR 52669. Regression-tested. OK for trunk? Thomas 2013-07-12 Thomas Koenig PR fortran/52669 * trans-decl.c (gfc_create_module_variable): Optionally warn about private module variable which is not used. 2013-07-12 Thomas Koenig PR fortran/52669 * fortran.dg/module_variable_1.f90: New test. Index: trans-decl.c =================================================================== --- trans-decl.c (Revision 200743) +++ trans-decl.c (Arbeitskopie) @@ -4212,6 +4212,11 @@ gfc_create_module_variable (gfc_symbol * sym) internal_error ("backend decl for module variable %s already exists", sym->name); + if (warn_unused_variable && !sym->attr.referenced + && sym->attr.access == ACCESS_PRIVATE) + gfc_warning ("Unused PRIVATE module variable '%s' declared at %L", + sym->name, &sym->declared_at); + /* We always want module variables to be created. */ sym->attr.referenced = 1; /* Create the decl. */