[Bug fortran/31461] warn about entities in USE, ONLY statement not later used
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Aug 17 13:36:00 GMT 2011
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
More information about the Gcc-bugs
mailing list