The commit 7ee3aac210a9fbf16b2a26314bed5b15fce90b8d introduces wrong
initialization code to gold/script-sections.cc and this prevents
building the file with g++ -W -Wall -Werror .
std::vector doesn't have ctor which takes one pointer argument
(see http://www.cplusplus.com/reference/stl/vector/vector/ ).
Probably the original author intended to initialize vma_sections_ (whose
type is std::vector ) so that it was empty.
According to the STL reference, the default ctor of std::vector suffices
for that purpose.
== Patch ==
diff --git a/gold/script-sections.cc b/gold/script-sections.cc
index 1a19ad8..d5c6f2f 100644
--- a/gold/script-sections.cc
+++ b/gold/script-sections.cc
@@ -54,9 +54,7 @@ class Memory_region
start_(start),
length_(length),
current_vma_offset_(0),
- current_lma_offset_(0),
- vma_sections_(NULL),
- lma_sections_(NULL)
+ current_lma_offset_(0)
{ }
// Return the name of this region.
== Obvervation of the bug ==
$ g++ -W -Werror -c script-sections.cc -o script-sections.o
cc1plus: warnings being treated as errors
script-sections.cc: In constructor 'gold::Memory_region::Memory_region(const
char*, size_t, unsigned int, gold::Expression*, gold::Expression*)':
script-sections.cc:59: warning: passing NULL to non-pointer argument 1 of
'std::vector<_Tp, _Alloc>::vector(size_t, const _Tp&, const _Alloc&) [with _Tp =
gold::Output_section_definition*, _Alloc =
std::allocator]'
script-sections.cc:59: warning: passing NULL to non-pointer argument 1 of
'std::vector<_Tp, _Alloc>::vector(size_t, const _Tp&, const _Alloc&) [with _Tp =
gold::Output_section_definition*, _Alloc =
std::allocator]'
make: *** [script-sections.o] Error 1
$ g++ --version
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cat /etc/redhat-release
CentOS release 5.5 (Final)
--
Summary: Illegal initialization vma_sections_(NULL)
Product: binutils
Version: 2.21 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: gold
AssignedTo: ian at airs dot com
ReportedBy: nodakai at gmail dot com
CC: bug-binutils at gnu dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=12007
--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.
___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils