From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10614 invoked by alias); 30 Jan 2009 13:48:18 -0000 Received: (qmail 10526 invoked by uid 48); 30 Jan 2009 13:48:02 -0000 Date: Fri, 30 Jan 2009 13:48:00 -0000 Message-ID: <20090130134802.10525.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/18624] GCC does not detect local variable set but never used In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dcb314 at hotmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-01/txt/msg03344.txt.bz2 ------- Comment #12 from dcb314 at hotmail dot com 2009-01-30 13:48 ------- (In reply to comment #1) > Yes this would be slightly useful but one has to be care full of what is > warned about. Agreed. For a first cut, a simple straight forward job, without considering the complex cases, could be the way forward. For example, all bets would be off for any variable that has it's address taken. To get some data on how many times this "set but not used" problem occurs in real code, I just had a go at compiling almost half the Suse Linux distribution source tree with Intel C/C++. For source codes [a-k]*, there where 906 occurrences of the "set but not used" warning from Intel C/C++. Given that Intel can't compile a lot of the GNU specific code, I estimate at least 2,000 and maybe 2,500 occurrences of this problem in Suse Linux distribution. Other distributions are different sizes, but at least this gives us a single data point on how frequently the "set but not used" problem occurs in practice. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18624