>Number: 8840 >Category: libstdc++ >Synopsis: 3.2.1: sort (v.begin (), v.end (), loc) dumps core >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Dec 06 03:16:02 PST 2002 >Closed-Date: >Last-Modified: >Originator: Franz Gans >Release: unknown-1.0 >Organization: >Environment: SuSE Linux 7.3 Linux xxxxxx 2.4.16-4GB #1 Mit Okt 30 14:20:02 CET 2002 i686 unknown gcc -v Reading specs from /usr5/xhome/softw1/install-3.2.1/lib/gcc-lib/i686-pc-linux-gn u/3.2.1/specs Configured with: ../gcc-3.2.1/configure --prefix=/usr5/xhome/softw1/install-3.2.1 --enable-threads --enable-shared Thread model: posix gcc version 3.2.1 >Description: With a german locale (de_DE) the letters "mpö" are sorted as 'm', 'ö' (like oe) and 'p'. bcc32 gives the correct result. gcc 3.2.1 gives a segmentation violation while gcc 3.2 seems to simply ignore any locale setting. In a gdb session one sees Program received signal SIGSEGV, Segmentation fault. 0x4017f031 in __strcoll_l () from /lib/libc.so.6 (gdb) bt #0 0x4017f031 in __strcoll_l () from /lib/libc.so.6 #1 0x4009eb20 in std::collate::_M_compare(char const*, char const*) const (this=0x0, __one=0x0, __two=0x0) at collate_members.cc:47 #2 0x4007d990 in std::collate::do_compare(char const*, char const*, char const*, char const*) const (this=0x0, __lo1=0x0, __hi1=0x0, __lo2=0x0, __hi2=0x0) at /usr5/xhome/softw1/build/objdir-3.2.1/i686-pc-linux-gnu/libstdc++-v3/incl ude/bits/basic_string.h:781 #3 0x08049d10 in bool std::locale::operator(), std ::allocator >(std::basic_string, std::allocat or > const&, std::basic_string, std::allocato r > const&) const (this=0x0, __s1=@0x0, __s2=@0x0) at /usr5/xhome/softw1/install-3.2.1/include/c++/3.2.1/bits/locale_facets.h:8 58 #4 0x08049d6b in void std::__insertion_sort<__gnu_cxx::__normal_iterator > >, std::locale>(_ _gnu_cxx::__normal_iterator > >, __gnu_cxx::__normal_iterator > >, std::locale) (__first= {, std::allocator >,int,std::basic_string, std::allocator >*,std::basic_string, std::allocator >&>> = {}, _M_current = 0x804f944}, __last= {, std::allocator >,int,std::basic_string, std::allocator >*,std::basic_string, std::allocator >&>> = {}, _M_current = 0x804f924}, __comp=Internal: global symbol `_ZNSt6locale4noneE' found in ../../../../gcc -3.2.1/libstdc++-v3/src/locale.cc psymtab but not in symtab. _ZNSt6locale4noneE may be an inlined function, or may be a template function (if a template, try specifying an instantiation: _ZNSt6locale4noneE). ) at /usr5/xhome/softw1/install-3.2.1/include/c++/3.2.1/bits/stl_iterator.h:59 3 #5 0x080498d5 in void std::__final_insertion_sort<__gnu_cxx::__normal_iterator< std::string*, std::vector > >, std::loc ale>(__gnu_cxx::__normal_iterator > >, __gnu_cxx::__normal_iterator > >, std::locale) (__first= {, std::allocator >,int,std::basic_string, std::allocator >*,std::basic_string, std::allocator >&>> = {}, _M_current = 0xbffff400}, __last= {, std::allocator >,int,std::basic_string, std::allocator >*,std::basic_string, std::allocator >&>> = {}, _M_current = 0x804f944}, __comp=Cannot access memory at address 0x0 ) at /usr5/xhome/softw1/install-3.2.1/include/c++/3.2.1/bits/stl_algo.h:2079 #6 0x0804909f in main () at /usr5/xhome/softw1/install-3.2.1/include/c++/3.2.1/bits/stl_algo.h:2210 #7 0x4011f7ee in __libc_start_main () from /lib/libc.so.6 >How-To-Repeat: g++ -O -g locale-sort-bug-3.2.1.cc [fails even w/o -O and -g] a.out >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="locale-sort-bug-3.2.1.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="locale-sort-bug-3.2.1.cc" Ly8NCi8vIDIwMDItMTItMDUgbG9jYWxlLXNvcnQtYnVnLTMuMi4xLmNjDQovLw0KDQojaW5jbHVk ZSA8aW9zdHJlYW0+DQojaW5jbHVkZSA8c3RyaW5nPg0KI2luY2x1ZGUgPGl0ZXJhdG9yPg0KI2lu Y2x1ZGUgPHZlY3Rvcj4NCiNpbmNsdWRlIDxsb2NhbGU+DQoNCmludCBtYWluICgpDQp7DQogICB1 c2luZyBuYW1lc3BhY2Ugc3RkOw0KDQogICBsb2NhbGUgbG9jICgiIik7ICAvLyBEZWZhdWx0IGxv Y2FsZQ0KDQogICB2ZWN0b3I8c3RyaW5nPiB2Ow0KICAgdi5wdXNoX2JhY2sgKCJtIik7DQogICB2 LnB1c2hfYmFjayAoInAiKTsNCiAgIHYucHVzaF9iYWNrICgi9iIpOw0KDQogICBjb3B5KHYuYmVn aW4oKSwgdi5lbmQoKSwgb3N0cmVhbV9pdGVyYXRvcjxzdHJpbmc+KGNvdXQsIiAiKSk7DQogICBj b3V0IDw8IGVuZGw7DQoNCiAgICAvLyBTb3J0IHRoZSBzdHJpbmdzIHVzaW5nIHRoZSBsb2NhbGUg YXMgYSBjb21wYXJpdG9yDQogICBzb3J0KHYuYmVnaW4oKSx2LmVuZCgpLGxvYyk7DQoNCiAgIGNv cHkodi5iZWdpbigpLHYuZW5kKCksIG9zdHJlYW1faXRlcmF0b3I8c3RyaW5nPihjb3V0LCIgIikp Ow0KDQogICBjb3V0IDw8IGVuZGw7DQp9DQo=