Boost logo

Boost :

Subject: [boost] Crash in boost::gregorian::from_simple_string in BOOST 1.36
From: ak1mbox-boost_at_[hidden]
Date: 2009-02-26 17:45:01


Hello,

I am using date_time library from Boost 1.36.

When running this code:

#include <boost/date_time/gregorian/gregorian.hpp>

void RunDates()
{
        boost::gregorian::date
today(boost::gregorian::day_clock::local_day());
        std::string todayString=boost::gregorian::to_simple_string(today);
        boost::gregorian::date
todayFromString(boost::gregorian::from_simple_string(todayString));
}

I get a reproducible crash when calling from_simple_string command on the last line of the function.

Here is the backtrace:

#0 0x961c9a12 in __gnu_debug::_Safe_iterator_base::_M_attach ()
#1 0x00003029 in
__gnu_debug::_Safe_iterator_base::_Safe_iterator_base
(this=0xbffff3ac, __seq=0x100698, __constant=false) at debug/
safe_base.h:89
#2 0x00006796 in
__gnu_debug
::_Safe_iterator<std::_Rb_tree_iterator<std::pair<std::string const, unsigned short> >, __gnu_debug_def::map<std::string, unsigned short, std::less<std::string>, std::allocator<std::pair<std::string const, unsigned short> > > >::_Safe_iterator (this=0xbffff3ac, __i=@0xbffff35c, __seq=0x100680) at debug/safe_iterator.h:110
#3 0x000068a2 in __gnu_debug_def::map<std::string, unsigned short, std::less<std::string>, std::allocator<std::pair<std::string const, unsigned short> > >::find (this=0x100680, __x=@0xbffff4a4) at debug/ map.h:220
#4 0x00006f11 in
boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>
(s=@0xbffff4a4) at date_parsing.hpp:68
#5 0x000071cb in boost::date_time::parse_date<boost::gregorian::date>
(s=@0xbffff51c, order_spec=0) at date_parsing.hpp:142
#6 0x00007445 in boost::gregorian::from_simple_string (s=@0xbffff51c) at parsers.hpp:35
#7 0x00001f85 in RunDates () at /dates.cpp:18
#8 0x00001e18 in main (argc=1, argv=0xbffff568) at /main.cpp:8

The code was compiled on OSX, gcc version 4.0.1 (Apple Inc. build
5490) with Debug flags, I am linking against dynamic data_time library.

Is this a known issue in 1.36 that was fixed in 1.38? going through the list of fixes did not uncover it.

The same example compiled with release flags works without problems. I am not certain if this means that I am missing some defines or that release compile misses errors that debug catches.

Any help with this is really appreciated!

Thank you,

Alex


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk