[Bug fortran/54997] -Wunused-function gives false warnings for procedures passed as actual argument

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Oct 21 13:48:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54997

--- Comment #5 from janus at gcc dot gnu.org 2012-10-21 13:48:38 UTC ---
(In reply to comment #4)
> The following removes the warning for s3:
> 
> [...]
> 
> but it also removes the warning on procedures which are really unused :(

This fixed by the following:

Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c    (revision 192619)
+++ gcc/fortran/parse.c    (working copy)
@@ -3928,7 +3928,6 @@ gfc_fixup_sibling_symbols (gfc_symbol *sym, gfc_na
   gfc_symtree *st;
   gfc_symbol *old_sym;

-  sym->attr.referenced = 1;
   for (ns = siblings; ns; ns = ns->sibling)
     {
       st = gfc_find_symtree (ns->sym_root, sym->name);
@@ -4050,7 +4049,6 @@ parse_contained (int module)
       /* Mark this as a contained function, so it isn't replaced
          by other module functions.  */
       sym->attr.contained = 1;
-      sym->attr.referenced = 1;

       /* Set implicit_pure so that it can be reset if any of the
          tests for purity fail.  This is used for some optimisation



More information about the Gcc-bugs mailing list