* [Bug fortran/54221] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
@ 2012-08-10 15:36 ` burnus at gcc dot gnu.org
2012-08-11 9:06 ` burnus at gcc dot gnu.org
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-10 15:36 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
2012-08-10 15:36 ` [Bug fortran/54221] " burnus at gcc dot gnu.org
@ 2012-08-11 9:06 ` burnus at gcc dot gnu.org
2012-08-12 9:53 ` burnus at gcc dot gnu.org
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-11 9:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-11 09:06:21 UTC ---
(In reply to comment #1)
> a) There is a bogus warning. I think that's a middle-end bug
See PR 54224.
> Patch for issue (b):
Seems to work. One might have to do likewise for module variables
(gfc_finish_var_decl), cf. PR52751. [The original code has been added for
PR40973 and fixed for PR52916.]
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
2012-08-10 15:36 ` [Bug fortran/54221] " burnus at gcc dot gnu.org
2012-08-11 9:06 ` 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
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-12 9:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-12 09:52:36 UTC ---
Author: burnus
Date: Sun Aug 12 09:52:33 2012
New Revision: 190325
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190325
Log:
2012-08-12 Tobias Burnus <burnus@net-b.de>
PR fortran/54221
* trans-decl.c (gfc_finish_var_decl, build_function_decl):
Fix setting private module vars/procs as TREE_PUBLIC(...) = 0.
2012-08-12 Tobias Burnus <burnus@net-b.de>
PR fortran/54221
* vect/vect-gems.f90: Don't mark module vars as PRIVATE as
they appear uninitialized on the RHS.
* gfortran.dg/public_private_module_6.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/public_private_module_6.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-decl.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/vect/vect-gems.f90
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (2 preceding siblings ...)
2012-08-12 9:53 ` burnus at gcc dot gnu.org
@ 2012-08-21 8:54 ` burnus at gcc dot gnu.org
2012-10-09 19:54 ` janus at gcc dot gnu.org
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-21 8:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |4.8.0
Summary|Explicit private access |[4.8 Regression] Explicit
|specifier signals |private access specifier
|"unexpected defined but not |signals "unexpected defined
|used [-Wunused-function]" |but not used
|warning |[-Wunused-function]"
| |warning
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-21 08:53:48 UTC ---
I mark this now as regression in the Fortran front-end to keep better track of
PR middle-end/54224: It seems as if part of the fix has to be done in the
Fortran front-end.
In this PR, the issue of having a different result with PRIVATE vs. "PRIVATE ::
entry_name" is now fixed.
It remains the issue that there is no warning for unused internal procedures
(or unused nested functions in C), no warning of unused PRIVATE module
variables and a spurious warning for *used* PRIVATE module procedures. Those
are tracked in PR 54224. Additionally, there is the issue that the private
module procedures is not inlined, see other PR and PR 48636 comment 18.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (3 preceding siblings ...)
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
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: janus at gcc dot gnu.org @ 2012-10-09 19:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |janus at gcc dot gnu.org
--- Comment #5 from janus at gcc dot gnu.org 2012-10-09 19:53:45 UTC ---
(In reply to comment #3)
> Author: burnus
> Date: Sun Aug 12 09:52:33 2012
> New Revision: 190325
>
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190325
Seems like this caused:
http://gcc.gnu.org/ml/fortran/2012-10/msg00046.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (4 preceding siblings ...)
2012-10-09 19:54 ` janus at gcc dot gnu.org
@ 2013-03-22 14:45 ` jakub at gcc dot gnu.org
2013-05-31 10:59 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-03-22 14:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.0 |4.8.1
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-03-22 14:44:27 UTC ---
GCC 4.8.0 is being released, adjusting target milestone.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (5 preceding siblings ...)
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
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-31 10:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.1 |4.8.2
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.1 has been released.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (6 preceding siblings ...)
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
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-10-16 9:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.2 |4.8.3
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.2 has been released.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (7 preceding siblings ...)
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
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-12-29 12:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2013-12-29
Ever confirmed|0 |1
--- Comment #9 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I mark this now as regression in the Fortran front-end to keep better track
> of PR middle-end/54224: It seems as if part of the fix has to be done
> in the Fortran front-end.
>
> In this PR, the issue of having a different result with PRIVATE vs.
> "PRIVATE :: entry_name" is now fixed.
I don't see the point to keep this PR open in addition of pr54224 (only one
issue left AFAIU). Also I don't think this is any longer a regression.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (8 preceding siblings ...)
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
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: janus at gcc dot gnu.org @ 2014-01-09 12:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |abensonca at gmail dot com
--- Comment #10 from janus at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #9)
> I don't see the point to keep this PR open in addition of pr54224 (only one
> issue left AFAIU). Also I don't think this is any longer a regression.
I agree that this PR can probably be closed.
Except: What happened to the problem of comment 5, i.e. the linking problems
with the FoX library? This is apparently the reason for the 'regression' tag. I
see no follow-ups to this either here or in the mailing list thread. Has it
been fixed? Or was it just false alarm?
Andrew, can you give as a comment about what happened to the linking problem?
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (9 preceding siblings ...)
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
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: abensonca at gmail dot com @ 2014-01-09 16:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
--- Comment #11 from Andrew Benson <abensonca at gmail dot com> ---
(In reply to janus from comment #10)
> (In reply to Dominique d'Humieres from comment #9)
> > I don't see the point to keep this PR open in addition of pr54224 (only one
> > issue left AFAIU). Also I don't think this is any longer a regression.
>
> I agree that this PR can probably be closed.
>
> Except: What happened to the problem of comment 5, i.e. the linking problems
> with the FoX library? This is apparently the reason for the 'regression'
> tag. I see no follow-ups to this either here or in the mailing list thread.
> Has it been fixed? Or was it just false alarm?
>
> Andrew, can you give as a comment about what happened to the linking problem?
This was fixed in PR54884 if I remember correctly.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (10 preceding siblings ...)
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
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: janus at gcc dot gnu.org @ 2014-01-10 10:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |FIXED
--- Comment #12 from janus at gcc dot gnu.org ---
(In reply to Andrew Benson from comment #11)
> This was fixed in PR54884 if I remember correctly.
Ok, thanks.
Then I'm closing this one ...
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (11 preceding siblings ...)
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
14 siblings, 0 replies; 16+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-09-13 13:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
Bug 54221 depends on bug 54224, which changed state.
Bug 54224 Summary: Warn for unused internal procedures
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54224
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (12 preceding siblings ...)
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
14 siblings, 0 replies; 16+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-09-13 13:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
--- Comment #13 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I agree that this PR can probably be closed.
Closing as FIXED. Please file new PR(s) for new issue(s).
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/54221] [4.8/4.9 Regression] Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning
2012-08-10 12:59 [Bug fortran/54221] New: Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning koen.poppe at cs dot kuleuven.be
` (13 preceding siblings ...)
2015-09-13 13:48 ` dominiq at lps dot ens.fr
@ 2015-09-13 15:24 ` dominiq at lps dot ens.fr
14 siblings, 0 replies; 16+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-09-13 15:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54221
Bug 54221 depends on bug 54224, which changed state.
Bug 54224 Summary: Warn for unused internal procedures
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54224
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
^ permalink raw reply [flat|nested] 16+ messages in thread