This is the mail archive of the gcc-patches@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]

[patch, fortran] PR43899 Wrong unused-variable warning with NAMELISTs


Hi,

This patch avoids the bogus warning. Still remaining is to check if a namelist is not used somewhere. I assume we need to scan a namespace. I would like to get this part committed before the last piece.

Regression tested on x86-64. OK for trunk?

Regards,

Jerry

2010-11-07 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/43899
	* trans-decl.c (generate_local_decl): Do not generate unused warning
	for variables in namelists.
Index: trans-decl.c
===================================================================
--- trans-decl.c	(revision 166426)
+++ trans-decl.c	(working copy)
@@ -4017,9 +4017,10 @@ generate_local_decl (gfc_symbol * sym)
 	}
 
       /* Warn for unused variables, but not if they're inside a common
-	 block or are use-associated.  */
+	 block, a namelist, or are use-associated.  */
       else if (warn_unused_variable
-	       && !(sym->attr.in_common || sym->attr.use_assoc || sym->mark))
+	       && !(sym->attr.in_common || sym->attr.use_assoc || sym->mark
+		    || sym->attr.in_namelist))
 	gfc_warning ("Unused variable '%s' declared at %L", sym->name,
 		     &sym->declared_at);
 

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