Details
Description
Compiling the test {{22.locale.codecvt.length.cpp. With IBM XLC++ 9.0 on AIX in 15d build type and running it from the command line (but not in the debugger or in nightly builds) makes it hang with the output below – note the line that reads: Error: bad_alloc: out of memory:
$ TOPDIR=~/stdcxx-4.2.x ./22.locale.codecvt.length # INFO (S1) (10 lines): # TEXT: # COMPILER: IBM VisualAge C++, __IBMCPP__ = 900 # ENVIRONMENT: powerpc running aix-5.3 # FILE: 22.locale.codecvt.length.cpp # COMPILED: Apr 22 2008, 12:15:12 # COMMENT: ############################################################ # CLAUSE: lib.locale.codecvt.virtuals # NOTE (S2) (5 lines): # TEXT: executing "rm -rf /tmp/tmpfile-elUaaa" # CLAUSE: lib.locale.codecvt.virtuals # FILE: process.cpp # LINE: 276 # NOTE (S2) (5 lines): # TEXT: executing "mkdir /tmp/tmpfile-elUaaa" # CLAUSE: lib.locale.codecvt.virtuals # FILE: process.cpp # LINE: 276 # INFO (S1) (3 lines): # TEXT: std::codecvt<char, char, mbstate_t>::length (state_type&, const extern_type*, const extern_type*, size_t) # CLAUSE: lib.locale.codecvt.virtuals # INFO (S1) (3 lines): # TEXT: std::codecvt_byname<char, char, mbstate_t>::length (state_type&, const extern_type*, const extern_type*, size_t) # CLAUSE: lib.locale.codecvt.virtuals # INFO (S1) (3 lines): # TEXT: std::codecvt<wchar_t, char, mbstate_t>::length (state_type&, const extern_type*, const extern_type*, size_t) # CLAUSE: lib.locale.codecvt.virtuals # INFO (S1) (3 lines): # TEXT: std::codecvt_byname<wchar_t, char, mbstate_t>::length (state_type&, const extern_type*, const extern_type*, size_t) # CLAUSE: lib.locale.codecvt.virtuals # INFO (S1) (3 lines): # TEXT: locale ("UTF-8@UCS") [algorithmic encoding] # CLAUSE: lib.locale.codecvt.virtuals # NOTE (S2) (5 lines): # TEXT: executing "../bin/localedef -w701 -w702 -w706 -c -f /tmp/tmpfile-elUaaa/charmap -i /tmp/tmpfile-elUaaa/source /tmp/tmpfile-elUaaa/mb_cur_max-9" # CLAUSE: lib.locale.codecvt.virtuals # FILE: process.cpp # LINE: 276 Error: bad_alloc: out of memory # ERROR (S8) (5 lines): # TEXT: the command "../bin/localedef -w701 -w702 -w706 -c -f /tmp/tmpfile-elUaaa/charmap -i /tmp/tmpfile-elUaaa/source /tmp/tmpfile-elUaaa/mb_cur_max-9" exited with status 4 # CLAUSE: lib.locale.codecvt.virtuals # FILE: process.cpp # LINE: 306 # ERROR (S8) (4 lines): # TEXT: failed to create a locale database # CLAUSE: lib.locale.codecvt.virtuals # LINE: 368 # NOTE (S2) (5 lines): # TEXT: executing "locale -a > /tmp/tmpfile-ftUaab" # CLAUSE: lib.locale.codecvt.virtuals # FILE: process.cpp # LINE: 276
The contents of the charmap and locale files are here:
$ cat /tmp/tmpfile-EXUnqa/charmap <code_set_name> test_charmap <comment_char> % <escape_char> / <mb_cur_min> 1 <mb_cur_max> 9 CHARMAP <U0000> /x30 0 <U0001> /x31 1 <U0002> /x32/x32 22 <U0003> /x33/x33/x33 333 <U0004> /x34/x34/x34/x34 4444 <U0005> /x35/x35/x35/x35/x35 55555 <U0006> /x36/x36/x36/x36/x36/x36 666666 <U0007> /x37/x37/x37/x37/x37/x37/x37 7777777 <U0008> /x38/x38/x38/x38/x38/x38/x38/x38 88888888 <U0009> /x39/x39/x39/x39/x39/x39/x39/x39/x39 999999999 <U0010> /x41 A <U0011> /x42 B <U0012> /x43 C END CHARMAP $ cat /tmp/tmpfile-EXUnqa/source LC_CTYPE END LC_CTYPE
Running the localedef command from the command line alternately crashes with a SIGSEGV or (less frequently) fails with the same bad_alloc error as when running the test:
$ ../bin/localedef -w701 -w702 -w706 -c -f /tmp/tmpfile-EXUnqa/charmap -i /tmp/tmpfile-EXUnqa/source /tmp/tmpfile-EXUnqa/mb_cur_max-9 Segmentation fault (core dumped)
The debugger shows the following stack trace for the crashed process:
$ dbx ../bin/localedef Type 'help' for help. [using memory image in core] reading symbolic information ... Segmentation fault in __DoThrowV6 at 0xd26a4b44 ($t1) 0xd26a4b44 (__DoThrowV6+0x2e0) 80830004 lwz r4,0x4(r3) (dbx) where __DoThrowV6() at 0xd26a4b44 __rw_throw_exception(int,char*)(id = 3, what = (nil)), line 674 in "exception.cpp" __rw_throw(int,...)(id = 3, ... = 0x20017660, 0x8, 0x0, 0x0, 0x103a21bf, 0x103a21bf, 0x27fffab0), line 786 in "exception.cpp" __rw_allocate(unsigned long,int)(nbytes = 33536, = 0), line 72 in "memory.cpp" collate.allocate(unsigned long,const void*)(0x2ff214fc, 0x20, 0x0), line 145 in "_allocator.h" __rw::__rb_tree<unsigned int,std::pair<const unsigned int,Def::offset_tab_t>,__rw::__select1st<std::pair<const unsigned int,Def::offset_tab_t>,unsigned int>,std::less<unsigned int>,std::allocator<std::pair<const unsigned int,Def::offset_tab_t> > >::_C_add_new_buffer()(this = 0x2ff21964), line 144 in "_tree.cc" collate._C_get_link()(0x2ff21964), line 362 in "_tree.h" def.__rw::__rb_tree<unsigned int,std::pair<const unsigned int,Def::offset_tab_t>,__rw::__select1st<std::pair<const unsigned int,Def::offset_tab_t>,unsigned int>,std::less<unsigned int>,std::allocator<std::pair<const unsigned int,Def::offset_tab_t> > >::_C_get_node()(this = 0x2ff21964), line 393 in "_tree.h" __rw::__rb_tree<unsigned int,std::pair<const unsigned int,Def::offset_tab_t>,__rw::__select1st<std::pair<const unsigned int,Def::offset_tab_t>,unsigned int>,std::less<unsigned int>,std::allocator<std::pair<const unsigned int,Def::offset_tab_t> > >::_C_init()(this = 0x2ff21964), line 460 in "_tree.h" __rw::__rb_tree<unsigned int,std::pair<const unsigned int,Def::offset_tab_t>,__rw::__select1st<std::pair<const unsigned int,Def::offset_tab_t>,unsigned int>,std::less<unsigned int>,std::allocator<std::pair<const unsigned int,Def::offset_tab_t> > >::__rb_tree(const std::less<unsigned int>&,const std::allocator<std::pair<const unsigned int,Def::offset_tab_t> >&)(this = 0x2ff21964, __cmp = &(...), __alloc = &(...)), line 56 in "_tree.cc" map(const std::less<unsigned int>&,const std::allocator<std::pair<const unsigned int,Def::offset_tab_t> >&)(this = 0x2ff21964, __cmp = &(...), __alloc = &(...)), line 124 in "map" Def::Def(const char*,const char*,Charmap&,bool)(this = 0x2ff217c0, filename = "/tmp/tmpfile-EXUnqa/source", out_name = "/tmp/tmpfile-EXUnqa/mb_cur_max-9", char_map = &(...), no_position = false), line 533 in "def.cpp" create_locale(std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,bool,bool,bool,bool)(std_src = &(...), std_cmap = &(...), outdir = &(...), std_locale = &(...), force_output = true, use_ucs = false, no_position = false, link_aliases = false), line 212 in "localedef.cpp" unnamed block in localedef_main(int,char**)(argc = 10, argv = 0x2ff22994), line 561 in "localedef.cpp" localedef_main(int,char**)(argc = 10, argv = 0x2ff22994), line 561 in "localedef.cpp" main(argc = 10, argv = 0x2ff22994), line 596 in "localedef.cpp"