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

PR14568 warning for unused variables in common blocks

Thsi fixes PR14568. gfortran shouldn't warn that c is unused in below example:
COMMON /a/b,c
b = 1.

This patch fixes this. A testcase will have to go into the dg-testsuite, which I will submit once I have figured out how to make it work.

Bootstrapped and regtested on i686-pc-linux. This also passed Steve Kargl's testsuite without new failures.

- Tobi

2004-04-22 Tobias Schlüter <>

	PR fortran/14568
	* trans-decl.c (generate_local_decl): Don't warn for unused
	variables which are in common blocks.

Index: trans-decl.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/fortran/Attic/trans-decl.c,v retrieving revision diff -u -p -r1.1.2.37 trans-decl.c --- trans-decl.c 24 Apr 2004 12:19:27 -0000 +++ trans-decl.c 8 May 2004 11:48:52 -0000 @@ -1855,7 +1863,9 @@ generate_local_decl (gfc_symbol * sym) if (warn_unused_parameter) warning ("unused parameter `%s'", sym->name); } - else if (warn_unused_variable) + /* 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); } }

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