]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Prevent -Wmaybe-uninitialized warning in cmse_scan users/ARM/embedded-binutils-2_26-branch-2016q2 users/ARM/embedded-gdb-2_26-branch-2016q1
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Wed, 22 Jun 2016 09:37:16 +0000 (10:37 +0100)
committerThomas Preud'homme <thomas.preudhomme@arm.com>
Wed, 22 Jun 2016 09:37:16 +0000 (10:37 +0100)
2016-06-22  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* bfd/elf32-arm.c (cmse_scan): Declare and initialize j in the
innermost conditional block containing all its uses.

bfd/ChangeLog.arm
bfd/elf32-arm.c

index 0e613565b4653f19364e541a8d1a81591e30741c..d1af3b5810435c8e4e7c8041f1641853b4fa17c0 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-22  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * bfd/elf32-arm.c (cmse_scan): Declare and initialize j in the
+       innermost conditional block containing all its uses.
+
 2016-06-20  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Mark sections holding
index 588f832cce261032b7a1bb0d217bad8f8e2ae0dd..36d2a338a2e8fa4d3c3d33f31af1abb3763f9385 100644 (file)
@@ -5531,10 +5531,14 @@ cmse_scan (bfd *input_bfd, struct elf32_arm_link_hash_table *htab,
              && hash->root.root.type != bfd_link_hash_defweak)
          || hash->root.type != STT_FUNC)
        {
+         /* Initialize here to avoid warning about use of possibly
+            uninitialized variable.  */
+         j = 0;
+
          if (!hash)
            {
              /* Searching for a normal symbol with local binding.  */
-             for (j = 0; j < ext_start; j++)
+             for (; j < ext_start; j++)
                {
                  lsym_name =
                    bfd_elf_string_from_elf_section (input_bfd,