NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/54411: std::locale broken



The following reply was made to PR toolchain/54411; it has been noted by GNATS.

From: Ryo ONODERA <ryo%tetera.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: toolchain/54411: std::locale broken
Date: Mon, 29 Jul 2019 15:21:53 +0900

 Hi,
 
 The following test case under C locale failed with the errer like
 pkgsrc/editors/poedit.
 
 $ cat test.cxx
 #include <iostream>
 #include <locale>
 using namespace std;
 
 void print_thousands_separator(const char *localestring)
 {
     std::locale loc = std::locale(localestring);
     auto thou_sep = std::use_facet<std::numpunct<wchar_t>>(loc).thousands_sep();
     wcout << "Thousands separator for " << localestring << " is '" << thou_sep << "'" << endl;
     return;
 }
 
 int main() {
     print_thousands_separator("en_US");
     print_thousands_separator("de_DE.UTF-8");
     print_thousands_separator("ja_JP.UTF-8");
     print_thousands_separator("fr_FR.UTF-8");
 }
 $ g++ test.cxx
 $ ./a.out
 Thousands separator for en_US is ','
 Thousands separator for de_DE.UTF-8 is ','
 Thousands separator for ja_JP.UTF-8 is ','
 zsh: segmentation fault (core dumped)  ./a.out
 (snip)
 Core was generated by `a.out'.
 Program terminated with signal SIGSEGV, Segmentation fault.
 #0  0x00007891d3d19beb in free () from /usr/lib/libc.so.12
 (gdb) bt
 #0  0x00007891d3d19beb in free () from /usr/lib/libc.so.12
 #1  0x00007891d4ce6b34 in std::__timepunct<char>::~__timepunct() ()
    from /usr/lib/libstdc++.so.9
 #2  0x00007891d4ce6b4b in std::__timepunct<char>::~__timepunct() ()
    from /usr/lib/libstdc++.so.9
 #3  0x00007891d4cb1311 in std::locale::_Impl::~_Impl() ()
    from /usr/lib/libstdc++.so.9
 #4  0x00007891d4cb166e in std::locale::~locale() ()
    from /usr/lib/libstdc++.so.9
 #5  0x0000000000401077 in print_thousands_separator(char const*) ()
 #6  0x00000000004010bc in main ()
 
 -- 
 Ryo ONODERA // ryo%tetera.org@localhost
 PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
 


Home | Main Index | Thread Index | Old Index