Boost logo

Boost Users :

Subject: Re: [Boost-users] Crash in VS2013, bug in compiler, boost or my code ? (flyweight, variant and initializer list)
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2013-12-13 19:43:07


On Fri, Dec 13, 2013 at 6:38 PM, Lars Viklund <zao_at_[hidden]> wrote:
> On Sat, Dec 14, 2013 at 12:30:31AM +0000, Andreas M. Iwanowski wrote:
>> Hello Lars, Hello Olivier;
>>
>> I have a suspicion that this may be with the initializer list; I do not have VS2013 handy.
>>
>> However, without initializer list and using push_back(), it compiles and runs without crash on both VS2010 and mingw gcc 3.4.2.
>> Could you try that maybe?
>
> Hi,
> Given OP's test case and replacing the vector initialization with three
> calls to push_back (or emplace_back, no difference) the program does not
> crash on shutdown.

Probably related to this: it's appears to be a known (and pretty
serious IMO) bug in the compiler.

http://connect.microsoft.com/VisualStudio/feedback/details/800104/

The report has to do with CString, but an SO blog explains how the
compiler is treating temporaries.

http://stackoverflow.com/questions/19269345/initializing-map-of-maps-with-initializer-list-in-vs-2013

Plausible workaround: avoid initializer lists, especially of VS20XX is
your target.

Other than that, HTH and good luck.

> I forgot to mention the address that the access violation triggered on
> in my repro run is "Access violation reading location 0xCCCCCCD4.", so
> an offset into "uninitialized stack memory" it seems.
>
> (Also note that the Boost list doesn't do top-posting, replies go
> in-line after the sections they refer to.)
>
>> -----Original Message-----
>> From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Lars Viklund
>> Sent: Saturday, December 14, 2013 12:27 AM
>> To: boost-users_at_[hidden]
>> Subject: Re: [Boost-users] Crash in VS2013, bug in compiler, boost or my code ? (flyweight, variant and initializer list)
>>
>> On Fri, Dec 13, 2013 at 10:54:08PM +0000, Andreas M. Iwanowski wrote:
>> > Care to define "crash"?
>> >
>> > If the compiler "crashes" (i.e. access violates; internal compiler error et. al.), then it is always a compiler bug; A compiler shouldn't choke on the input.
>>
>> It seems to be a runtime failure during post-main shutdown, not an ICE.
>> Stack trace follows:
>> ====8<====
>> testbed2013-hz.exe!std::_Tree<std::_Tset_traits<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type>,0> >::_Orphan_ptr(std::_Tree<std::_Tset_traits<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type>,0> > & _Cont, std::_Tree_node<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,void *> * _Ptr)
> Line 221
>> 8 C++
>> testbed2013-hz.exe!std::_Tree<std::_Tset_traits<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type>,0> >::clear() Line 1540 C++
>> testbed2013-hz.exe!std::_Tree<std::_Tset_traits<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type>,0> >::erase(std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type> > > _First, std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type> > > _Last) Line 1515 C++
>> testbed2013-hz.exe!std::_Tree<std::_Tset_traits<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type>,0> >::_Tidy() Line 2230 C++
>> testbed2013-hz.exe!std::_Tree<std::_Tset_traits<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type>,0> >::~_Tree<std::_Tset_traits<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type>,0> >() Line 1193 C++
>> testbed2013-hz.exe!std::set<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type> >::~set<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type> >() C++
>> testbed2013-hz.exe!boost::flyweights::assoc_container_factory_class<std::set<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type> > >::~assoc_container_factory_class<std::set<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type> > >() C++
>> testbed2013-hz.exe!boost::flyweights::set_factory_class<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,boost::mpl::na,boost::mpl::na>::~set_factory_class<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::rep_type,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,boost::mpl::na,boost::mpl::na>() C++
>> testbed2013-hz.exe!boost::flyweights::detail::flyweight_core<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,boost::mpl::na,boost::flyweights::no_tracking,boost::flyweights::set_factory<boost::mpl::na,boost::mpl::na,0>,boost::flyweights::simple_locking,boost::flyweights::static_holder>::holder_arg::~holder_arg() C++
>> > testbed2013-hz.exe!`boost::flyweights::static_holder_class<boost::flyweights::detail::flyweight_core<boost::flyweights::detail::default_value_policy<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,boost::mpl::na,boost::flyweights::no_tracking,boost::flyweights::set_factory<boost::mpl::na,boost::mpl::na,0>,boost::flyweights::simple_locking,boost::flyweights::static_holder>::holder_arg>::get'::`2'::`dynamic atexit destructor for 'c''() C++
>> msvcr120d.dll!doexit(int code, int quick, int retcaller) Line 628 C
>> msvcr120d.dll!exit(int code) Line 417 C
>> testbed2013-hz.exe!__tmainCRTStartup() Line 662 C
>> testbed2013-hz.exe!mainCRTStartup() Line 466 C
>> kernel32.dll!@BaseThreadInitThunk_at_12() Unknown
>> ntdll.dll!__RtlUserThreadStart() Unknown
>> ntdll.dll!__RtlUserThreadStart_at_8() Unknown
>> ====8<====
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> --
> Lars Viklund | zao_at_[hidden]
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net