This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] tests: ensure backtrace.c exec_dump sets jmp


With CFLAGS='-Og -g', F21 gcc hits -Werror=maybe-uninitialized on jmp in
the call "prepare_thread (pid2, jmp)".  It's fine with -O2/-O0.

The only way this could be unset is if the loop before ran to
completion, and there's already an assert against this case.

This patch initializes jmp anyway to convince gcc it's ok.

Signed-off-by: Josh Stone <jistone@redhat.com>
---
 tests/ChangeLog   | 4 ++++
 tests/backtrace.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 97c7ab88c1d3..3db06b4b5c7d 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2015-02-11  Josh Stone  <jistone@redhat.com>
+
+	* backtrace.c (exec_dump): Initialize jmp.
+
 2015-01-21  Mark Wielaard  <mjw@redhat.com>
 
 	* Makefile.am (check_PROGRAMS): Add elfstrtab.
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 331ba0f2bed5..e109654f5e41 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -377,7 +377,7 @@ exec_dump (const char *exec)
 #else /* __x86_64__ */
   is_x86_64_native = ehdr->e_ident[EI_CLASS] == ELFCLASS64;
 #endif /* __x86_64__ */
-  void (*jmp) (void);
+  void (*jmp) (void) = 0;
   if (is_x86_64_native)
     {
       // Find inferior symbol named "jmp".
-- 
2.1.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]