This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/31461] warn about entities in USE, ONLY statement not later used


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]