From: "Yakov Lerner" <iler.ml@gmail.com>
To: gdb-patches@sourceware.org
Subject: fix for compilation error with gcc 3.2.3 (warning treated as error; `funaddr' might be used uninitialized)
Date: Thu, 14 Feb 2008 09:39:00 -0000 [thread overview]
Message-ID: <f36b08ee0802140139p64c2004ao3d622456b52da3f2@mail.gmail.com> (raw)
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;
next reply other threads:[~2008-02-14 9:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-14 9:39 Yakov Lerner [this message]
2008-02-14 16:51 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f36b08ee0802140139p64c2004ao3d622456b52da3f2@mail.gmail.com \
--to=iler.ml@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox