* [pushed] Fix maybe-uninitialized warning in frame.c
@ 2023-03-31 15:18 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-03-31 15:18 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
A recent patch caused my system gcc (Fedora 36, so gcc 12.2.1) to warn
about sym_addr being possibly uninitialized in frame.c. It isn't, but
the compiler can't tell. So, this patch initializes the variable. I
also fixed a formatting buglet that I missed in review.
---
gdb/frame.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/gdb/frame.c b/gdb/frame.c
index 4f420f138f6..36fb02f3c8e 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2537,7 +2537,7 @@ inside_main_func (frame_info_ptr this_frame)
if (current_program_space->symfile_object_file == nullptr)
return false;
- CORE_ADDR sym_addr;
+ CORE_ADDR sym_addr = 0;
const char *name = main_name ();
bound_minimal_symbol msymbol
= lookup_minimal_symbol (name, NULL,
@@ -2573,8 +2573,9 @@ inside_main_func (frame_info_ptr this_frame)
/* Convert any function descriptor addresses into the actual function
code address. */
- sym_addr = gdbarch_convert_from_func_ptr_addr
- (get_frame_arch (this_frame), sym_addr, current_inferior ()->top_target ());
+ sym_addr = (gdbarch_convert_from_func_ptr_addr
+ (get_frame_arch (this_frame), sym_addr,
+ current_inferior ()->top_target ()));
return sym_addr == get_frame_func (this_frame);
}
--
2.39.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-31 15:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 15:18 [pushed] Fix maybe-uninitialized warning in frame.c Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).