From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22781 invoked by alias); 23 Oct 2007 23:17:33 -0000 Received: (qmail 22769 invoked by uid 22791); 23 Oct 2007 23:17:33 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 23 Oct 2007 23:17:31 +0000 Received: (qmail 32177 invoked from network); 23 Oct 2007 23:17:29 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 23 Oct 2007 23:17:29 -0000 To: Carlos O'Donell Cc: gdb-patches@sourceware.org, Daniel Jacobowitz Subject: Re: [PATCH] Fix uninitialized use of variables. References: <20071020172137.GC28823@lios> From: Jim Blandy Date: Tue, 23 Oct 2007 23:20:00 -0000 In-Reply-To: <20071020172137.GC28823@lios> (Carlos O'Donell's message of "Sat, 20 Oct 2007 13:21:39 -0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00558.txt.bz2 Carlos O'Donell writes: > In symtab.c (find_line_common) the variable *exact_match is not set if > no match is found. Callers of find_line_common expect *exact_match to be > set. The solution is to initialize *exact_match to zero, assuming an > inexact match. In the case that we don't find a match in > find_line_common, the statement `(best_index < 0 || !exact)' in > symtab.c:2267 is true, instead of undefined. The comment is adjusted to > indicate that one must look at another symtab if we failed to find a > match `best_index < 0' or we found an inexact match `!exact.' As far as the symtab.c change is concerned: the specification of find_line_common is that *EXACT_MATCH is set only if the function returns a match (a non-negative value). As far as I can see, find_line_symtab doesn't actually use the value of 'exact' unless the corresponding call to find_line_common returned a match. So the warning looks spurious to me. (I don't mind initializing 'exact' in find_line_symtab to placate the compiler.)