From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21675 invoked by alias); 12 Jul 2012 13:45:10 -0000 Received: (qmail 21656 invoked by uid 22791); 12 Jul 2012 13:45:09 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Jul 2012 13:44:56 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/53940] Optionally warn about multiple explicit USE-association of the same symbol Date: Thu, 12 Jul 2012 13:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Keywords Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-07/txt/msg00959.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53940 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Summary|warn about duplicate USE |Optionally warn about | |multiple explicit | |USE-association of the same | |symbol --- Comment #3 from Tobias Burnus 2012-07-12 13:44:55 UTC --- (In reply to comment #2) > I guess I see the USE ONLY as similar to a declaration, and to have two of the > same declarations in a program is an error, e.g., > $ cat duplicate_declaration.f90 << EOF > program duplicate_declaration > integer :: var > integer :: var Well, here you declare two different variables with the same name. In the original example, you use associate the same variable under the same name. Thus, technically, this example is invalid while the first one is valid. (At least that's how I understand the Fortran standard.) However, I concur that one could warn if the same variable appears multiple times in a "USE ..., ONLY:" either as you had: use mod, only: var use mod, only: var or as in use mod, only: var, var Both are perfectly valid, but I concur that (in well written code) it should not occur. I don't think we want to warn for: use mod use mod, only: var which also (kind of) use-associates "var" multiple times. The warning implementation should be doable somewhere in the depths of module.c as we only set "sym->attr.use_only" for explicitly use-associated symbols.