This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] PATCH: Fix PR 15510
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: GCC Fortran mailing list <fortran at gcc dot gnu dot org>,patch <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 09 Jun 2004 20:09:39 +0200
- Subject: [gfortran] PATCH: Fix PR 15510
This is a follow-up for my patch to prevent the printing of unused
variable messages for variables in common blocks, this also prevents
them for use-associated variables, which is PR 15510.
I'm wondering if this code shouldn't be moved to the resolution stage,
as this would allow for better error printing because we could print out
the loci where the variable is declared. Possibly we can only do this
after PR 15481 is fixed.
- Tobi
2004-06-09 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15510
* trans-decl.c (generate_local_decl): Do not issue warning for
unused variables if they're use associated.
Index: trans-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-decl.c,v
retrieving revision 1.11
diff -u -p -r1.11 trans-decl.c
--- trans-decl.c 9 Jun 2004 12:55:48 -0000 1.11
+++ trans-decl.c 9 Jun 2004 18:07:05 -0000
@@ -1921,9 +1921,10 @@ generate_local_decl (gfc_symbol * sym)
warning ("unused parameter `%s'", sym->name);
}
/* warn for unused variables, but not if they're inside a common
- block. */
- else if (warn_unused_variable && !sym->attr.in_common)
- warning ("unused variable `%s'", sym->name);
+ block or are use_associated. */
+ else if (warn_unused_variable
+ && !(sym->attr.in_common || sym->attr.use_assoc))
+ warning ("unused variable `%s'", sym->name);
}
}