This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold] Merging string literals with bigger alignment
- From: Cary Coutant <ccoutant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>, Alexander Ivchenko <aivchenk at gmail dot com>, binutils <binutils at sourceware dot org>
- Date: Wed, 1 May 2013 10:39:39 -0700
- Subject: Re: [gold] Merging string literals with bigger alignment
- References: <CAHACq4odyq1ok_SWBFNUDreq8=b-4MMqp3DXJY03viF2-HUe8w at mail dot gmail dot com> <CACysShj2TB84vkATNQhDVYx7QURtx29Qpb5t+i_i2OP6R-zgZQ at mail dot gmail dot com> <CAHACq4q4=bd1gB9LEBJRwOnqDTYQxZ_Z=BKN++M0KSPqDdGJtg at mail dot gmail dot com> <CACysShjX+kaq8CAcCWDMcvChGrUPYNz4XQGYbk+okV2baGPfJQ at mail dot gmail dot com> <CAHACq4rN=nj5wX5AJYwKSbqnDfbMPC=p9CvGJR-y-JjKi=0gqw at mail dot gmail dot com> <CAKOQZ8y7DMUSWh5dozvxBD1a8uW981K+Gwn95JTqcGFkAHdVOg at mail dot gmail dot com> <CACysShhF+sh1vebktXwoc6epBJ8FQTMTjXRURm7nJT9MfjUvLA at mail dot gmail dot com> <CAHACq4p4fqA2YiJLPsxoP=+KMy-9H+r2Jyp_WXhzxxcDgxa0aQ at mail dot gmail dot com> <CACysShiw_kcnug9u8ShzS-k0qQVdrz3wk5kB2Aqh=cZmaQrPhA at mail dot gmail dot com> <CAHACq4q7CReFbYaeK+APLLhi+oKxBcv4d-2o4wjvkxRpx=Uj_A at mail dot gmail dot com> <20130501022527 dot GC5221 at bubble dot grove dot modra dot org>
> 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);