<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - linker failure - std::allocator ; g++ produces a binary example included"
   href="http://llvm.org/bugs/show_bug.cgi?id=16419">16419</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>linker failure - std::allocator ; g++ produces a binary example included
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>netprobe@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10741" name="attach_10741" title="pick.cc : increment a counter in random elements of a std::map">attachment 10741</a> <a href="attachment.cgi?id=10741&action=edit" title="pick.cc : increment a counter in random elements of a std::map">[details]</a></span>
pick.cc : increment a counter in random elements of a std::map

The included source file was compiled both with g++ and clang with the
following outcomes:

g++
mulander@craig-laptop:~/code/cpp/misc$ g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 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.

mulander@craig-laptop:~/code/cpp/misc$ g++ -Wall -pedantic pick.cc
mulander@craig-laptop:~/code/cpp/misc$ ./a.out 
'         A': 315
'         B': 336
'         C': 349
mulander@craig-laptop:~/code/cpp/misc$

clang
mulander@craig-laptop:~/code/cpp/misc$ clang --version
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
mulander@craig-laptop:~/code/cpp/misc$ clang -v pick.cc
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
 "/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name pick.cc -mrelocation-model
static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -target-linker-version 2.22 -momit-leaf-frame-pointer -v
-resource-dir /usr/bin/../lib/clang/3.0 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem /usr/include/c++/4.6
-internal-isystem /usr/include/c++/4.6/x86_64-linux-gnu -internal-isystem
/usr/include/c++/4.6/backward -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include
-fdeprecated-macro -ferror-limit 19 -fmessage-length 177 -fgnu-runtime
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/pick-RXgU3R.o -x c++ pick.cc
clang -cc1 version 3.0 based upon llvm 3.0 hosted on x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
ignoring nonexistent directory "/usr/include/c++/4.6//x86_64-linux-gnu/64"
ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
ignoring duplicate directory "/usr/include/c++/4.6"
ignoring duplicate directory "/usr/include/c++/4.6/backward"
ignoring duplicate directory "/usr/include/c++/4.6"
ignoring duplicate directory "/usr/include/c++/4.6/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/c++/4.6/backward"
ignoring duplicate directory "/usr/include/c++/4.6"
ignoring duplicate directory "/usr/include/c++/4.6/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/c++/4.6/backward"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.6
 /usr/include/c++/4.6/x86_64-linux-gnu
 /usr/include/c++/4.6/backward
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
 /usr/include/clang/3.0/include/
 /usr/lib/gcc/x86_64-linux-gnu/4.6/include/
 /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/
End of search list.
 "/usr/bin/ld" -z relro --hash-style=gnu --as-needed --build-id --eh-frame-hdr
-m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/4.6
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib64 -L/lib/x86_64-linux-gnu
-L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../.. -L/lib/x86_64-linux-gnu -L/lib
-L/usr/lib/x86_64-linux-gnu -L/usr/lib /tmp/pick-RXgU3R.o -lgcc --as-needed
-lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crtn.o
/tmp/pick-RXgU3R.o: In function `main':
pick.cc:(.text+0x8b): undefined reference to
`std::allocator<char>::allocator()'
pick.cc:(.text+0xa5): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char const*,
std::allocator<char> const&)'
pick.cc:(.text+0x14c): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()'
pick.cc:(.text+0x15d): undefined reference to
`std::allocator<char>::~allocator()'
pick.cc:(.text+0x1e6): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()'
pick.cc:(.text+0x1f7): undefined reference to
`std::allocator<char>::~allocator()'
pick.cc:(.text+0x279): undefined reference to
`std::allocator<char>::allocator()'
pick.cc:(.text+0x293): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char const*,
std::allocator<char> const&)'
pick.cc:(.text+0x2ce): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()'
pick.cc:(.text+0x2df): undefined reference to
`std::allocator<char>::~allocator()'
pick.cc:(.text+0x324): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()'
pick.cc:(.text+0x335): undefined reference to
`std::allocator<char>::~allocator()'
pick.cc:(.text+0x3d5): undefined reference to `std::string::c_str() const'
pick.cc:(.text+0x4b8): undefined reference to `std::terminate()'
/tmp/pick-RXgU3R.o: In function `std::map<std::string, int,
std::less<std::string>, std::allocator<std::pair<std::string const, int> >
<span class="quote">>::operator[](std::string const&)':</span >
pick.cc:(.text._ZNSt3mapISsiSt4lessISsESaISt4pairIKSsiEEEixERS3_[_ZNSt3mapISsiSt4lessISsESaISt4pairIKSsiEEEixERS3_]+0x150):
undefined reference to `std::terminate()'
/tmp/pick-RXgU3R.o: In function `std::_Rb_tree_iterator<std::pair<std::string
const, int> >::operator++()':
pick.cc:(.text._ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEppEv[_ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEppEv]+0x1b):
undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string const,
int>::pair(std::string const&, int const&)':
pick.cc:(.text._ZNSt4pairIKSsiEC2ERS0_RKi[_ZNSt4pairIKSsiEC2ERS0_RKi]+0x24):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::string const&)'
/tmp/pick-RXgU3R.o: In function `std::_Rb_tree<std::string,
std::pair<std::string const, int>, std::_Select1st<std::pair<std::string const,
int> >, std::less<std::string>, std::allocator<std::pair<std::string const,
int> > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base
const*, std::pair<std::string const, int> const&)':
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE10_M_insert_EPKSt18_Rb_tree_node_baseSB_RKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE10_M_insert_EPKSt18_Rb_tree_node_baseSB_RKS2_]+0xc4):
undefined reference to `std::_Rb_tree_insert_and_rebalance(bool,
std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
/tmp/pick-RXgU3R.o: In function
`std::_Rb_tree_const_iterator<std::pair<std::string const, int>
<span class="quote">>::operator--()':</span >
pick.cc:(.text._ZNSt23_Rb_tree_const_iteratorISt4pairIKSsiEEmmEv[_ZNSt23_Rb_tree_const_iteratorISt4pairIKSsiEEmmEv]+0x1b):
undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base
const*)'
/tmp/pick-RXgU3R.o: In function
`std::_Rb_tree_const_iterator<std::pair<std::string const, int>
<span class="quote">>::operator++()':</span >
pick.cc:(.text._ZNSt23_Rb_tree_const_iteratorISt4pairIKSsiEEppEv[_ZNSt23_Rb_tree_const_iteratorISt4pairIKSsiEEppEv]+0x1b):
undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base
const*)'
/tmp/pick-RXgU3R.o: In function `std::_Rb_tree_iterator<std::pair<std::string
const, int> >::operator--()':
pick.cc:(.text._ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEmmEv[_ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEmmEv]+0x1b):
undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
/tmp/pick-RXgU3R.o: In function `std::_Rb_tree<std::string,
std::pair<std::string const, int>, std::_Select1st<std::pair<std::string const,
int> >, std::less<std::string>, std::allocator<std::pair<std::string const,
int> > >::_M_create_node(std::pair<std::string const, int> const&)':
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_]+0xa0):
undefined reference to `__cxa_begin_catch'
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_]+0xbb):
undefined reference to `__cxa_rethrow'
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_]+0xce):
undefined reference to `__cxa_end_catch'
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_]+0x102):
undefined reference to `std::terminate()'
/tmp/pick-RXgU3R.o: In function
`__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::string const, int>
<span class="quote">> >::deallocate(std::_Rb_tree_node<std::pair<std::string const, int> >*,</span >
unsigned long)':
pick.cc:(.text._ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE10deallocateEPS5_m[_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE10deallocateEPS5_m]+0x1c):
undefined reference to `operator delete(void*)'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string const,
int>::pair(std::pair<std::string const, int> const&)':
pick.cc:(.text._ZNSt4pairIKSsiEC2ERKS1_[_ZNSt4pairIKSsiEC2ERKS1_]+0x2b):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::string const&)'
/tmp/pick-RXgU3R.o: In function
`__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::string const, int>
<span class="quote">> >::allocate(unsigned long, void const*)':</span >
pick.cc:(.text._ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE8allocateEmPKv]+0x33):
undefined reference to `std::__throw_bad_alloc()'
pick.cc:(.text._ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE8allocateEmPKv]+0x40):
undefined reference to `operator new(unsigned long)'
/tmp/pick-RXgU3R.o: In function `bool std::operator< <char,
std::char_traits<char>, std::allocator<char> >(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)':
pick.cc:(.text._ZStltIcSt11char_traitsIcESaIcEEbRKSbIT_T0_T1_ES8_[_ZStltIcSt11char_traitsIcESaIcEEbRKSbIT_T0_T1_ES8_]+0x19):
undefined reference to `std::string::compare(std::string const&) const'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string const,
int>::pair<std::string, int>(std::pair<std::string, int> const&)':
pick.cc:(.text._ZNSt4pairIKSsiEC2ISsiEERKS_IT_T0_E[_ZNSt4pairIKSsiEC2ISsiEERKS_IT_T0_E]+0x2b):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::string const&)'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string, int>::pair(std::string
const&, int const&)':
pick.cc:(.text._ZNSt4pairISsiEC2ERKSsRKi[_ZNSt4pairISsiEC2ERKSsRKi]+0x24):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::string const&)'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string, int>::~pair()':
pick.cc:(.text._ZNSt4pairISsiED2Ev[_ZNSt4pairISsiED2Ev]+0x11): undefined
reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::~basic_string()'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string const, int>::~pair()':
pick.cc:(.text._ZNSt4pairIKSsiED2Ev[_ZNSt4pairIKSsiED2Ev]+0x11): undefined
reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::~basic_string()'
/tmp/pick-RXgU3R.o:(.eh_frame+0x13): undefined reference to
`__gxx_personality_v0'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mulander@craig-laptop:~/code/cpp/misc$</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>