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]

Re: [gold] Merging string literals with bigger alignment


> On powerpc64 with a different compiler:
> gold/stringpool.cc:220:23: error: ‘offset’ may be used uninitialized in this function [-Werror=uninitialized]
> cc1plus: all warnings being treated as errors
> and indeed the code is wrong.

I've fixed the uninit warning as follows.

-cary


gold/
        * stringpool.cc (Stringpool_template::new_key_offset): Fix
        uninitialized warning.

Index: stringpool.cc
===================================================================
RCS file: /cvs/src/src/gold/stringpool.cc,v
retrieving revision 1.35
diff -u -p -r1.35 stringpool.cc
--- stringpool.cc 29 Apr 2013 17:15:08 -0000 1.35
+++ stringpool.cc 1 May 2013 17:34:42 -0000
@@ -222,9 +222,10 @@ Stringpool_template<Stringpool_char>::ne
     offset = 0;
   else
     {
+      offset = this->offset_;
       // Align non-zero length strings.
       if (length != 0)
- offset = align_address(this->offset_, this->addralign_);
+ offset = align_address(offset, this->addralign_);
       this->offset_ = offset + (length + 1) * sizeof(Stringpool_char);
     }
   this->key_to_offset_.push_back(offset);


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