public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31461] warn about entities in USE, ONLY statement not later used
[not found] <bug-31461-4@http.gcc.gnu.org/bugzilla/>
@ 2011-08-17 13:36 ` burnus at gcc dot gnu.org
2011-08-17 16:33 ` burnus at gcc dot gnu.org
2011-08-17 17:00 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-08-17 13:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31461
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> 2011-08-17 13:27:05 UTC ---
That's simpler than I though. Draft patch:
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -4453,6 +4453,9 @@ generate_local_decl (gfc_symbol * sym)
|| sym->attr.in_namelist))
gfc_warning ("Unused variable '%s' declared at %L", sym->name,
&sym->declared_at);
+ else if (warn_unused_variable && sym->attr.use_only)
+ gfc_warning ("Unused module variable '%s' which has been explicitly "
+ "imported at %L", sym->name, &sym->declared_at);
/* For variable length CHARACTER parameters, the PARM_DECL already
references the length variable, so force gfc_get_symbol_decl
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/31461] warn about entities in USE, ONLY statement not later used
[not found] <bug-31461-4@http.gcc.gnu.org/bugzilla/>
2011-08-17 13:36 ` [Bug fortran/31461] warn about entities in USE, ONLY statement not later used burnus at gcc dot gnu.org
@ 2011-08-17 16:33 ` burnus at gcc dot gnu.org
2011-08-17 17:00 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-08-17 16:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31461
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-17 16:31:20 UTC ---
Author: burnus
Date: Wed Aug 17 16:31:10 2011
New Revision: 177833
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177833
Log:
2011-08-17 Tobias Burnus <burnus@net-b.de>
PR fortran/31461
* trans-decl.c (generate_local_decl): Warn about
unused explicitly imported module variables/parameters.
2011-08-17 Tobias Burnus <burnus@net-b.de>
PR fortran/31461
* gfortran.dg/warn_unused_var_2.f90: New.
* gfortran.dg/warn_unused_var_3.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/warn_unused_var_2.f90
trunk/gcc/testsuite/gfortran.dg/warn_unused_var_3.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-decl.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/31461] warn about entities in USE, ONLY statement not later used
[not found] <bug-31461-4@http.gcc.gnu.org/bugzilla/>
2011-08-17 13:36 ` [Bug fortran/31461] warn about entities in USE, ONLY statement not later used burnus at gcc dot gnu.org
2011-08-17 16:33 ` burnus at gcc dot gnu.org
@ 2011-08-17 17:00 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-08-17 17:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31461
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-17 16:32:30 UTC ---
FIXED on the trunk (GCC 4.7).
Thanks for the suggestion - and sorry for taking 4 years to implement it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/31461] New: warn about entities in USE, ONLY statement not later used
@ 2007-04-03 16:04 vivekrao4 at yahoo dot com
2007-04-18 6:08 ` [Bug fortran/31461] " fxcoudert at gcc dot gnu dot org
0 siblings, 1 reply; 4+ messages in thread
From: vivekrao4 at yahoo dot com @ 2007-04-03 16:04 UTC (permalink / raw)
To: gcc-bugs
I request that gfortran optionally warn about entities appearing in a USE, ONLY
statement that are not later referenced in the program block where the USE
appears. For example, for the code
module util_mod
integer :: i,j
end module util_mod
program main
use util_mod, only: i,j
j = 1
print*,"j=",j
end program main
g95 -Wall -Wextra -c
says
In file xunused_simple.f90:6
use util_mod, only: i,j
1
Warning (136): Module variable 'i' at (1) is never used
In file xunused_simple.f90:6
use util_mod, only: i,j
1
Warning (109): ONLY variable 'i' USE-d at (1) is never used or set
--
Summary: warn about entities in USE, ONLY statement not later
used
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vivekrao4 at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31461
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-17 16:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-31461-4@http.gcc.gnu.org/bugzilla/>
2011-08-17 13:36 ` [Bug fortran/31461] warn about entities in USE, ONLY statement not later used burnus at gcc dot gnu.org
2011-08-17 16:33 ` burnus at gcc dot gnu.org
2011-08-17 17:00 ` burnus at gcc dot gnu.org
2007-04-03 16:04 [Bug fortran/31461] New: " vivekrao4 at yahoo dot com
2007-04-18 6:08 ` [Bug fortran/31461] " fxcoudert at gcc dot gnu dot org
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).