Fix a potential use of an uninitialised variable error in gold.
authorNick Clifton <nickc@redhat.com>
Wed, 24 Jun 2020 16:38:16 +0000 (17:38 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 24 Jun 2020 16:38:16 +0000 (17:38 +0100)
* target-reloc.h (issue_discarded_error): Initialise the
key_symndx variable.

gold/ChangeLog
gold/target-reloc.h

index 4d524d7f5acf4a037581210797da793f21ea2fd4..78b5579cd877a6ea7bbf1d09c1c343abc71689e5 100644 (file)
@@ -1,3 +1,8 @@
+2020-06-24  Nick Clifton  <nickc@redhat.com>
+
+       * target-reloc.h (issue_discarded_error): Initialise the
+       key_symndx variable.
+
 2020-06-23  Roland McGrath  <mcgrathr@google.com>
 
        PR 22843
index 2b205a1a74bfb7d73b26ba04d321e7735bfd5887..e9e3e5b0027107daa7eccebd72049f78b8aec706 100644 (file)
@@ -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)