https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71641
Bug ID: 71641
Summary: 22_locale/time_get/get_date/wchar_t/4.cc runs failure
if static linking
Product: gcc
Version: 5.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: cctsai57 at gmail dot com
Target Milestone: ---
Hi,
I try to simplify the testcase as the following code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <locale>
#include <sstream>
#include <ctime>
int main()
{
std::istringstream iss{ "17.12.2003" };
iss.imbue( std::locale{ "de_DE.UTF-8" } );
auto& time_get_facet = std::use_facet<std::time_get<char>>( iss.getloc() );
using iterator_type = std::istreambuf_iterator<char>;
iterator_type begin{ iss };
iterator_type end;
auto err = std::ios_base::goodbit;
std::tm t{};
time_get_facet.get_date( begin, end, iss, err, &t );
// 12/17/2003
if ( err != std::ios_base::eofbit ||
t.tm_mon != 11 ||
t.tm_mday != 17 ||
t.tm_year != 103)
__builtin_abort();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The default compiler is dyanmic linking and it runs PASS, but
FAIL if static linking:
$ g++ -std=gnu++11 -static test.cc
$ a.out
Abort!
My Fedora host has de_DE.UTF-8 locale date:
$ LC_ALL=de_DE.UTF-8 locale -k -c d_fmt
LC_TIME
d_fmt="%d.%m.%Y"
The following versions of gcc and glibc have the same problem:
(1) g++ (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
glibc 2.21
Fedora: Linux 4.4.13-200.fc22.x86_64
(2) g++ (GCC) 6.1.1 20160621
glibc 2.21
(3) arm-linux-gnueabihf-g++ (GCC) 6.1.1 20160623
glibc 2.23