This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[GOLD] warning fixes


A couple of warning fixes.  The first was found with gcc-4.3.4, the
second with gcc-4.7.2 and -O3.  OK?

	* dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
	comparison warning.
	* layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
	uninitialized" warning.

Index: gold/dwp.cc
===================================================================
RCS file: /cvs/src/src/gold/dwp.cc,v
retrieving revision 1.7
diff -u -p -r1.7 dwp.cc
--- gold/dwp.cc	1 Mar 2013 23:05:27 -0000	1.7
+++ gold/dwp.cc	20 Mar 2013 23:45:41 -0000
@@ -1476,7 +1476,7 @@ Dwp_output_file::add_contribution(elfcpp
 				  int align)
 {
   const char* section_name = get_dwarf_section_name(section_id);
-  gold_assert(section_id < this->section_id_map_.size());
+  gold_assert(static_cast<size_t>(section_id) < this->section_id_map_.size());
   unsigned int shndx = this->section_id_map_[section_id];
 
   // Create the section if necessary.
Index: gold/layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.246
diff -u -p -r1.246 layout.cc
--- gold/layout.cc	10 Mar 2013 23:08:18 -0000	1.246
+++ gold/layout.cc	20 Mar 2013 23:45:41 -0000
@@ -4158,7 +4158,7 @@ Layout::create_dynamic_symtab(const Inpu
 						       false,
 						       ORDER_DYNAMIC_LINKER,
 						       false);
-
+  *pdynstr = dynstr;
   if (dynstr != NULL)
     {
       Output_section_data* strdata = new Output_data_strtab(&this->dynpool_);
@@ -4174,8 +4174,6 @@ Layout::create_dynamic_symtab(const Inpu
 	  odyn->add_section_address(elfcpp::DT_STRTAB, dynstr);
 	  odyn->add_section_size(elfcpp::DT_STRSZ, dynstr);
 	}
-
-      *pdynstr = dynstr;
     }
 
   // Create the hash tables.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]