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

Bug#731886: g++-4.7: errors from valgrind for C++ program using default locale



Package: g++-4.7
Version: 4.7.2-5
Severity: normal

Hi,

the test program

#include <locale>
int main(int, char **) { std::locale loc(""); }

gives an error when run under valgrind:

==1792== Invalid read of size 8
==1792==    at 0x56E5388: wcscmp (wcscmp.S:464)
==1792==    by 0x4EA9554: std::moneypunct<wchar_t, false>::~moneypunct() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==1792==    by 0x4EA95C8: std::moneypunct<wchar_t, false>::~moneypunct() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==1792==    by 0x4EA02B4: std::locale::_Impl::~_Impl() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==1792==    by 0x4EA03EC: std::locale::~locale() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==1792==    by 0x40060D: main (in testcase)
==1792==  Address 0x59f80d8 is 0 bytes after a block of size 8 alloc'd
==1792==    at 0x4C2A147: operator new[](unsigned long) (vg_replace_malloc.c:348)
==1792==    by 0x4EAAC11: std::moneypunct<wchar_t, false>::_M_initialize_moneypunct(__locale_struct*, char const*) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==1792==    by 0x4EA27B7: std::locale::_Impl::_Impl(char const*, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==1792==    by 0x4EA3281: std::locale::locale(char const*) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18)
==1792==    by 0x400601: main (in testcase)
==1792== 

Actually using facets from the locale object leads to a segmentation fault from locale::~locale().

This problem also exists in g++ 4.6, and may exist in 4.8 (not tested).

   Simon

-- System Information:
Debian Release: 7.2
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.11-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages g++-4.7 depends on:
ii  gcc-4.7             4.7.2-5
ii  gcc-4.7-base        4.7.2-5
ii  libc6               2.17-96
ii  libgmp10            2:5.0.5+dfsg-2
ii  libmpc2             0.9-4
ii  libmpfr4            3.1.2-1
ii  libstdc++6-4.7-dev  4.7.2-5
ii  zlib1g              1:1.2.7.dfsg-13

g++-4.7 recommends no packages.

Versions of packages g++-4.7 suggests:
pn  g++-4.7-multilib    <none>
pn  gcc-4.7-doc         <none>
pn  libstdc++6-4.7-dbg  <none>

-- no debconf information


Reply to: