Commit: Fix uninitialised use in gold/target-reloc.h

Nick Clifton nickc@redhat.com
Wed Jun 24 16:37:08 GMT 2020


Hi Guys,

  I am applying the patch below to fix a potential uninitialised use
  detected in gold's target-reloc.h file.  (The detection was triggered
  when compiling for the s390x target using gcc-10).

Cheers
  Nick

gold/ChangeLog
2020-06-24  Nick Clifton  <nickc@redhat.com>

	* target-reloc.h (issue_discarded_error): Initialise the
	key_symndx variable.

diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index 2b205a1a74..e9e3e5b002 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -258,7 +258,7 @@ issue_discarded_error(
 							     &is_ordinary);
   if (orig_shndx != elfcpp::SHN_UNDEF)
     {
-      unsigned int key_symndx;
+      unsigned int key_symndx = 0;
       Relobj* kept_obj = object->find_kept_section_object(orig_shndx,
 							  &key_symndx);
       if (key_symndx != 0)



More information about the Binutils mailing list