This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Always initialize local
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Cc: ccoutant at google dot com
- Date: Mon, 11 Apr 2011 22:56:19 -0700
- Subject: gold patch committed: Always initialize local
I committed this patch to gold to always initialize a local variable.
This fixes a compiler warning when building gold with optimization with
gcc 4.4.3.
Ian
2011-04-11 Ian Lance Taylor <iant@google.com>
* incremental.cc (Sized_incr_relobj::do_add_symbols): Always
initialize local variable v.
Index: incremental.cc
===================================================================
RCS file: /cvs/src/src/gold/incremental.cc,v
retrieving revision 1.28
diff -p -u -r1.28 incremental.cc
--- incremental.cc 12 Apr 2011 00:44:47 -0000 1.28
+++ incremental.cc 12 Apr 2011 05:54:56 -0000
@@ -1668,7 +1668,7 @@ Sized_incr_relobj<size, big_endian>::do_
if (!strtab.get_c_string(gsym.get_st_name(), &name))
name = "";
- typename elfcpp::Elf_types<size>::Elf_Addr v;
+ typename elfcpp::Elf_types<size>::Elf_Addr v = gsym.get_st_value();
unsigned int shndx = gsym.get_st_shndx();
elfcpp::STB st_bind = gsym.get_st_bind();
elfcpp::STT st_type = gsym.get_st_type();
@@ -1688,7 +1688,6 @@ Sized_incr_relobj<size, big_endian>::do_
{
// Find the input section and calculate the section-relative value.
gold_assert(shndx != elfcpp::SHN_UNDEF);
- v = gsym.get_st_value();
Output_section* os = this->ibase_->output_section(shndx);
gold_assert(os != NULL && os->has_fixed_layout());
typename Input_entry_reader::Input_section_info sect =