[Bug libstdc++/40712] New: locale(const locale&, const char*, locale::category) can create broken locale
tsyvarev at ispras dot ru
gcc-bugzilla@gcc.gnu.org
Fri Jul 10 12:56:00 GMT 2009
This code causes SIGFAULT on Ubuntu 8.10:
#include <locale>
using namespace std;
int main()
{
locale loc(locale("C"), "en_US", locale::monetary);
use_facet<moneypunct<char> >(loc).grouping();
return 0;
}
Tested both with native gcc and one builded from svn.
According to gdb, sigfault is caused by strlen while converting c-string to
c++-string when returns from moneypunct<char>::do_grouping().
andrew@andrew-desktop:~/work/test$ gcc --version
gcc (Ubuntu 4.3.2-1ubuntu12) 4.3.2
Copyright (C) 2008 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.
andrew@andrew-desktop:~/work/test$ /home/andrew/gcc/bin/gcc --version
gcc (GCC) 4.5.0 20090709 (experimental)
Copyright (C) 2009 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.
andrew@andrew-desktop:~/work/test$ g++ test.cpp && ./a.out
Segmentation fault
--
Summary: locale(const locale&, const char*, locale::category) can
create broken locale
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tsyvarev at ispras dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40712
More information about the Gcc-bugs
mailing list