From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30533 invoked by alias); 14 Feb 2008 09:39:24 -0000 Received: (qmail 30524 invoked by uid 22791); 14 Feb 2008 09:39:23 -0000 X-Spam-Check-By: sourceware.org Received: from an-out-0708.google.com (HELO an-out-0708.google.com) (209.85.132.244) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 14 Feb 2008 09:39:06 +0000 Received: by an-out-0708.google.com with SMTP id c23so85987anc.42 for ; Thu, 14 Feb 2008 01:39:04 -0800 (PST) Received: by 10.100.214.15 with SMTP id m15mr1165669ang.80.1202981943840; Thu, 14 Feb 2008 01:39:03 -0800 (PST) Received: by 10.100.125.5 with HTTP; Thu, 14 Feb 2008 01:39:03 -0800 (PST) Message-ID: Date: Thu, 14 Feb 2008 09:39:00 -0000 From: "Yakov Lerner" To: gdb-patches@sourceware.org Subject: fix for compilation error with gcc 3.2.3 (warning treated as error; `funaddr' might be used uninitialized) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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: 2008-02/txt/msg00227.txt.bz2 Fix for the warning (warning treated as error) `funaddr' might be used uninitialized in this function' under gcc 3.2.3. I am not sure this is the best way to fix the warning, anyway. *** gdb/infcall.c.000 Thu Feb 14 12:04:51 2008 --- gdb/infcall.c Thu Feb 14 12:19:07 2008 *************** *** 222,242 **** else { /* Handle function descriptors lacking debug info. */ ! int found_descriptor = 0; if (VALUE_LVAL (function) == lval_memory) { ! CORE_ADDR nfunaddr; ! funaddr = value_as_address (value_addr (function)); ! nfunaddr = funaddr; ! funaddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch, ! funaddr, ¤t_target); ! if (funaddr != nfunaddr) ! found_descriptor = 1; } - if (!found_descriptor) - /* Handle integer used as address of a function. */ - funaddr = (CORE_ADDR) value_as_long (function); } value_type = builtin_type_int; --- 222,238 ---- else { /* Handle function descriptors lacking debug info. */ ! funaddr = (CORE_ADDR) value_as_long (function); if (VALUE_LVAL (function) == lval_memory) { ! CORE_ADDR nfunaddr, afunaddr; ! nfunaddr = value_as_address (value_addr (function)); ! afunaddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch, ! nfunaddr, ¤t_target); ! if (afunaddr != nfunaddr) ! funaddr = afunaddr; } } value_type = builtin_type_int; gcc -c -g -O2 -I. -I.././gdb -I.././gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I.././gdb/../include/opcode -I.././gdb/../readline/.. -I../bfd -I.././gdb/../bfd -I.././gdb/../include -DMI_OUT=1 -DTUI=1 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-unused -Wno-switch -Wno-char-subscripts -Werror infcall.c cc1: warnings being treated as errors infcall.c: In function `find_function_addr': infcall.c:190: warning: `funaddr' might be used uninitialized in this function make[2]: *** [infcall.o] Error 1 value_type = builtin_type_int; --- 222,239 ---- else { /* Handle function descriptors lacking debug info. */ ! funaddr = (CORE_ADDR) value_as_long (function); if (VALUE_LVAL (function) == lval_memory) { ! CORE_ADDR nfunaddr, afunaddr; ! nfunaddr = value_as_address (value_addr (function)); ! afunaddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch, ! nfunaddr, ¤t_target); ! if (afunaddr != nfunaddr) ! /* Handle integer used as address of a function. */ ! funaddr = afunaddr; } } value_type = builtin_type_int;