Subject: [Boost-bugs] [Boost C++ Libraries] #9054: filesystem::path::codecvt() segfault pre-main with static filesystem
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-08-27 16:18:05
#9054: filesystem::path::codecvt() segfault pre-main with static filesystem
------------------------------+------------------------
Reporter: lukester_null@⦠| Owner: bemandawes
Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
Version: Boost 1.54.0 | Severity: Problem
Keywords: |
------------------------------+------------------------
Hi
Should boost::filesystem::path::codecvt() work pre-main when using static
builds of the library? I'm getting a NULL std::locale::_M_impl in
std::locale::locale(const std::locale &).
Simple test case:
{{{
#include "boost/filesystem.hpp"
static const boost::filesystem::path::codecvt_type &dummy =
boost::filesystem::path::codecvt();
int main()
{
return 0;
}
}}}
Compiled with:
g++ Main.cpp -o Test -lboost_filesystem -lboost_system
-L/path/to/static/libs/only -I/path/to/boost -g
Yields:
{{{
(gdb) bt
#0 __atomic_add_dispatch (__val=1, __mem=0x0)
at /usr/src/debug/gcc-4.8.1-20130603/obj-x86_64-redhat-linux/x86_64
-redhat-linux/libstdc++-v3/include/ext/atomicity.h:96
#1 _M_add_reference (this=0x0)
at /usr/src/debug/gcc-4.8.1-20130603/obj-x86_64-redhat-linux/x86_64
-redhat-linux/libstdc++-v3/include/bits/locale_classes.h:510
#2 std::locale::locale (
this=0x609630
<boost::filesystem::path::codecvt()::posix_lazy_initialization>,
__other=...)
at ../../../../../libstdc++-v3/src/c++98/locale.cc:80
#3 0x00000000004023dc in boost::filesystem::path::codecvt() ()
#4 0x0000000000401a2f in __static_initialization_and_destruction_0
(__initialize_p=1,
__priority=65535) at Main.cpp:3
#5 0x0000000000401a4b in _GLOBAL__sub_I_main () at Main.cpp:8
#6 0x000000000040787d in __libc_csu_init ()
#7 0x0000003f09a21b05 in __libc_start_main (main=0x4019c0 <main()>,
argc=1, ubp_av=0x7fffffffd6d8,
init=0x407830 <__libc_csu_init>, fini=<optimized out>,
rtld_fini=<optimized out>,
stack_end=0x7fffffffd6c8) at libc-start.c:217
#8 0x00000000004018fd in _start ()
}}}
Move the dummy into main() and all is well.
(The actual code isn't trying to call codecvt directly; it's creating a
path from a G++ vstring.)
Thanks
Luke Elliott.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9054> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC