[PATCH] Silence some uninitialized variable warnings that appear when bootstrapping

Eric Gallager egall@gwmail.gwu.edu
Fri Sep 2 13:40:00 GMT 2016


While I was silencing some warnings about narrowing conversions, which
was https://gcc.gnu.org/ml/gcc-patches/2016-08/msg02129.html (for
reference), I also silenced some warnings from -Wmaybe-uninitialized
in combine.c and varasm.c while I was at it. I took the easy way out
and simply initialized the variables; there might possibly be a better
way to go about it, I don't know...

Thanks,
Eric Gallager
-------------- next part --------------
 gcc/combine.c | 2 +-
 gcc/varasm.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 1b262f9..b45d991 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1122,7 +1122,7 @@ static int
 combine_instructions (rtx_insn *f, unsigned int nregs)
 {
   rtx_insn *insn, *next;
-  rtx_insn *prev;
+  rtx_insn *prev = NULL;
   struct insn_link *links, *nextlinks;
   rtx_insn *first;
   basic_block last_bb;
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 00a9b30..140052b 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -774,7 +774,7 @@ mergeable_string_section (tree decl ATTRIBUTE_UNUSED,
 			  unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED,
 			  unsigned int flags ATTRIBUTE_UNUSED)
 {
-  HOST_WIDE_INT len;
+  HOST_WIDE_INT len = 0;
 
   if (HAVE_GAS_SHF_MERGE && flag_merge_constants
       && TREE_CODE (decl) == STRING_CST


More information about the Gcc-patches mailing list