Really obscure C++ mangling error with -fnew-abi

Chip Salzenberg chip@valinux.com
Fri Jun 30 17:26:00 GMT 2000


C++ folks: This is going to be hard to slog through -- or at least
hard to read -- but please bear with me.  I think it's a real bug.
It might even be two bugs.

-----------------------------------------------------------------------

The attached source file, when compiled with -fnew-abi and
-fimplicit-templates, defines a constructor named:

   _ZSt26__uninitialized_fill_n_auxIPSbIcSt11char_traitsIcESaIcEEjS3_ET_S5_T0_RKT1_5_BoolILb0EE

which, when translated, means:

   std::basic_string<char, std::char_traits<char>, std::allocator<char> >*
   std::__uninitialized_fill_n_aux<std::basic_string<char,
						     std::char_traits<char>,
						     std::allocator<char> >*,
				   unsigned,
				   std::allocator>
     (std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
      unsigned, const std::allocator&, _Bool<false>)

Note that the third template parameter is std::allocator<char>.

However, this is wrong in at least one way, and maybe two.

(1) The function in question is _referenced_ -- by code compiled with the
same compiler! -- under a _different_ name:

    _ZSt26__uninitialized_fill_n_auxIPSbIcSt11char_traitsIcESaIcEEjSsET_S5_T0_RKT1_5_BoolILb0EE

which, when translated, means:

    std::basic_string<char, std::char_traits<char>, std::allocator<char> >*
    std::__uninitialized_fill_n_aux<std::basic_string<char,
						      std::char_traits<char>,
						      std::allocator<char> >*,
				    unsigned,
				    std::string>
     (std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
      unsigned, const std::string&, _Bool<false>)

This reference name is likely to be more correct than the definition
name, since the third template parameter of __uninitialized_fill_n_aux
is supposed to be a value type, not an allocator type.

(2) Why is std::string showing up as std::string in some places and as
"basic_string<char, std::char_traits<char>, std::allocator<char> >" in
other places??
-- 
Chip Salzenberg              - a.k.a. -              <chip@valinux.com>
"I wanted to play hopscotch with the impenetrable mystery of existence,
    but he stepped in a wormhole and had to go in early."  // MST3K
-------------- next part --------------
A non-text attachment was scrubbed...
Name: misc-inst.i.gz
Type: application/x-gzip
Size: 81358 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20000630/4e9b8a7e/attachment.bin>


More information about the Gcc-bugs mailing list