From f3da8a96ee360c98a94b47835e8f238e61cf5f11 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 24 Aug 2020 12:58:14 +0930 Subject: [PATCH] gcc-4 -Og false positive "may be used uninitialised" binutils/ * readelf.c (dump_section_as_strings) Avoid false positive "may be used uninitialised". gas/ * config/tc-arm.c (move_or_literal_pool): Avoid false positive "may be used uninitialised". (opcode_lookup): Likewise. --- binutils/ChangeLog | 5 +++++ binutils/readelf.c | 2 +- gas/ChangeLog | 6 ++++++ gas/config/tc-arm.c | 10 ++++------ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ef4b8cb3dc0..4be47478b32 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2020-08-24 Alan Modra + + * readelf.c (dump_section_as_strings) Avoid false positive + "may be used uninitialised". + 2020-08-22 H.J. Lu PR ld/26382 diff --git a/binutils/readelf.c b/binutils/readelf.c index c47a77ca8fd..86be92e3b00 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -13968,7 +13968,7 @@ dump_section_as_strings (Elf_Internal_Shdr * section, Filedata * filedata) if (maxlen > 0) { - char c; + char c = 0; while (maxlen) { diff --git a/gas/ChangeLog b/gas/ChangeLog index 1aa2792851d..75cf73e749a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2020-08-24 Alan Modra + + * config/tc-arm.c (move_or_literal_pool): Avoid false positive + "may be used uninitialised". + (opcode_lookup): Likewise. + 2020-08-24 Alan Modra PR 26526 diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index c5ad2607b37..3eb7e9640a3 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -8898,16 +8898,13 @@ move_or_literal_pool (int i, enum lit_type t, bfd_boolean mode_3) /* Check if on thumb2 it can be done with a mov.w, mvn or movw instruction. */ unsigned int newimm; - bfd_boolean isNegated; + bfd_boolean isNegated = FALSE; newimm = encode_thumb32_immediate (v); - if (newimm != (unsigned int) FAIL) - isNegated = FALSE; - else + if (newimm == (unsigned int) FAIL) { newimm = encode_thumb32_immediate (~v); - if (newimm != (unsigned int) FAIL) - isNegated = TRUE; + isNegated = TRUE; } /* The number can be loaded with a mov.w or mvn @@ -22622,6 +22619,7 @@ opcode_lookup (char **str) /* Look for unaffixed or special-case affixed mnemonic. */ opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base, end - base); + cond = NULL; if (opcode) { /* step U */ -- 2.30.2