public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/53940] warn about duplicate USE Date: Thu, 12 Jul 2012 13:09:00 -0000 [thread overview] Message-ID: <bug-53940-4-07QCYKC7D3@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-53940-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53940 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-07-12 13:08:51 UTC --- (In reply to comment #0) > The old DEC Alpha compiler does: [...] > f90: Error: duplicate_use.f90, line 8: The same named entity from different > modules and/or program units cannot be referenced. [VAR] > print*, var > ----------^ That that one is completely bogus. The standard allows multiple inclusion of the same variable; and your variable is - contrary to the error message - from the same module. For instance, the following is valid: use mod use mod, var2 => var That way one has use-associated the variable "var" under the name "var" and under the name "var2". The Fortran standard (here: Fortran 2008, "11.2.2 The USE statement and use association") has: "More than one USE statement for a given module may appear in a specification part. If one of the USE statements is without an ONLY option, all public entities in the module are accessible. If all the USE statements have ONLY options, only those entities in one or more of the only-lists are accessible. "An accessible entity in the referenced module has one or more local identifiers. [...]" (Cf. http://gcc.gnu.org/wiki/GFortranStandards) Hence, I am inclined to reject the warning proposal. (The request to print an error is simply invalid.) However, if you can give a good argument why you want to have a special warning and when it exactly should be triggered, one could consider it. However, I currently fail to see a real use case for that. Note: module entities which have been explicitly use associated but aren't used are warned for. Thus, one could consider to warn if the same entity under the same name is multiple times use associated. However, that's not only valid but seems to be also harmless and a rather special case.
next prev parent reply other threads:[~2012-07-12 13:09 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-07-12 12:33 [Bug fortran/53940] New: " Bil.Kleb at NASA dot gov 2012-07-12 13:09 ` burnus at gcc dot gnu.org [this message] 2012-07-12 13:25 ` [Bug fortran/53940] " Bil.Kleb at NASA dot gov 2012-07-12 13:45 ` [Bug fortran/53940] Optionally warn about multiple explicit USE-association of the same symbol burnus at gcc dot gnu.org 2014-05-19 16:03 ` Joost.VandeVondele at mat dot ethz.ch 2015-10-13 16:28 ` dominiq at lps dot ens.fr 2020-07-30 15:37 ` dominiq at lps dot ens.fr
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-53940-4-07QCYKC7D3@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).