This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/54997] -Wunused-function gives false warnings for procedures passed as actual argument
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 20 Oct 2012 21:46:12 +0000
- Subject: [Bug fortran/54997] -Wunused-function gives false warnings for procedures passed as actual argument
- Auto-submitted: auto-generated
- References: <bug-54997-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54997
--- Comment #4 from janus at gcc dot gnu.org 2012-10-20 21:46:12 UTC ---
The following removes the warning for s3:
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c (revision 192619)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -1854,6 +1854,9 @@ build_function_decl (gfc_symbol * sym, bool global
|| sym->attr.public_used))
TREE_PUBLIC (fndecl) = 1;
+ if (sym->attr.referenced)
+ TREE_USED (fndecl) = 1;
+
attributes = add_attributes_to_decl (attr, NULL_TREE);
decl_attributes (&fndecl, attributes, 0);
but it also removes the warning on procedures which are really unused :(