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/54221] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning Date: Fri, 10 Aug 2012 15:36:00 -0000 [thread overview] Message-ID: <bug-54221-4-iQxy69pZpc@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-54221-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic CC| |burnus at gcc dot gnu.org --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-10 15:35:40 UTC --- I think there are two issues: a) There is a bogus warning. I think that's a middle-end bug b) The same warning should be triggered for "PRIVATE" and for "PRIVATE :: hello_integer" However, the Fortran front end only checks sym->attr.access == ACCESS_PRIVATE, which obviously doesn't get set by "PRIVATE". (See patch below.) That's a missed-optimization issue. Simplified example (compile with -Wall or -Wunused-function): module mod_say_hello private :: hello_integer contains subroutine say_hello() call hello_integer(123) end subroutine say_hello subroutine hello_integer( a ) integer, intent(in) :: a print *, "Hello ", a, "!" end subroutine hello_integer end module mod_say_hello Patch for issue (b): --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1841,2 +1841,9 @@ build_function_decl (gfc_symbol * sym, bool global) + if (sym->attr.access == ACCESS_UNKNOWN + && sym->ns->proc_name && sym->ns->proc_name->attr.flavor == FL_MODULE + && (sym->ns->default_access == ACCESS_PRIVATE + || (sym->ns->default_access == ACCESS_UNKNOWN + && gfc_option.flag_module_private))) + sym->attr.access = ACCESS_PRIVATE; + if (!current_function_decl
next prev parent reply other threads:[~2012-08-10 15:36 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-08-10 12:59 [Bug fortran/54221] New: " koen.poppe at cs dot kuleuven.be 2012-08-10 15:36 ` burnus at gcc dot gnu.org [this message] 2012-08-11 9:06 ` [Bug fortran/54221] " burnus at gcc dot gnu.org 2012-08-12 9:53 ` burnus at gcc dot gnu.org 2012-08-21 8:54 ` [Bug fortran/54221] [4.8 Regression] " burnus at gcc dot gnu.org 2012-10-09 19:54 ` janus at gcc dot gnu.org 2013-03-22 14:45 ` [Bug fortran/54221] [4.8/4.9 " jakub at gcc dot gnu.org 2013-05-31 10:59 ` jakub at gcc dot gnu.org 2013-10-16 9:49 ` jakub at gcc dot gnu.org 2013-12-29 12:40 ` dominiq at lps dot ens.fr 2014-01-09 12:28 ` janus at gcc dot gnu.org 2014-01-09 16:56 ` abensonca at gmail dot com 2014-01-10 10:23 ` janus at gcc dot gnu.org 2015-09-13 13:45 ` dominiq at lps dot ens.fr 2015-09-13 13:48 ` dominiq at lps dot ens.fr 2015-09-13 15:24 ` 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-54221-4-iQxy69pZpc@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).