Crash in VS2013, bug in compiler, boost or my code ? (flyweight, variant and initializer list)
Hello Boost users, Using the following sample code I have some crash in VS2013 but it works fine in LLVM on OSX Is this is a mistake on my side or an issue elsewhere ? #include <string> #include <cstdint> #include <vector> #include <boost/flyweight/flyweight.hpp> #include <boost/flyweight/no_tracking.hpp> #include <boost/flyweight/static_holder.hpp> #include <boost/flyweight/set_factory.hpp> #include <boost/flyweight/simple_locking.hpp> #include <boost/variant.hpp> typedef boost::flyweights::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::set_factory<>, boost::flyweights::static_holder, boost::flyweights::simple_locking
string_flyweight;
typedef boost::variant< bool, double, string_flyweight
Variant;
int main(void) { std::vector<Variant> v = { 1., true, string_flyweight("toto") }; return 0; } Thanks, -- Olivier TRISTAN uvi.net
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. Mit freundlichen Grüßen / With best regards Andreas Iwanowski - IT Administrator / Software Developer www.awato.de | namezero@afim.info T: +49 (0)2133 26031 55 | F: +49 (0)2133 26031 01 awato Software GmbH | Salm Reifferscheidt Allee 37 | D-41540 Dormagen avisor-Support | T: +49 (0)621 6094 043 | F: +49 (0)621 6071 447 Geschäftsführer: Ursula Iwanowski | HRB: Neuss 7208 | VAT-no.: DE 122796158 -----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Olivier Tristan Sent: Friday, December 13, 2013 6:16 PM To: boost-users@lists.boost.org Subject: [Boost-users] Crash in VS2013, bug in compiler, boost or my code ? (flyweight, variant and initializer list) Hello Boost users, Using the following sample code I have some crash in VS2013 but it works fine in LLVM on OSX Is this is a mistake on my side or an issue elsewhere ? #include <string> #include <cstdint> #include <vector> #include <boost/flyweight/flyweight.hpp> #include <boost/flyweight/no_tracking.hpp> #include <boost/flyweight/static_holder.hpp> #include <boost/flyweight/set_factory.hpp> #include <boost/flyweight/simple_locking.hpp> #include <boost/variant.hpp> typedef boost::flyweights::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::set_factory<>, boost::flyweights::static_holder, boost::flyweights::simple_locking
string_flyweight;
typedef boost::variant< bool, double, string_flyweight
Variant;
int main(void) { std::vector<Variant> v = { 1., true, string_flyweight("toto") }; return 0; } Thanks, -- Olivier TRISTAN uvi.net _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
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 2218 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@12() Unknown ntdll.dll!__RtlUserThreadStart() Unknown ntdll.dll!__RtlUserThreadStart@8() Unknown ====8<====
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? Mit freundlichen Grüßen / With best regards Andreas Iwanowski - IT Administrator / Software Developer www.awato.de | namezero@afim.info T: +49 (0)2133 26031 55 | F: +49 (0)2133 26031 01 awato Software GmbH | Salm Reifferscheidt Allee 37 | D-41540 Dormagen avisor-Support | T: +49 (0)621 6094 043 | F: +49 (0)621 6071 447 Geschäftsführer: Ursula Iwanowski | HRB: Neuss 7208 | VAT-no.: DE 122796158 -----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Lars Viklund Sent: Saturday, December 14, 2013 12:27 AM To: boost-users@lists.boost.org 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@12() Unknown ntdll.dll!__RtlUserThreadStart() Unknown ntdll.dll!__RtlUserThreadStart@8() Unknown ====8<==== _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
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. 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@lists.boost.org] On Behalf Of Lars Viklund Sent: Saturday, December 14, 2013 12:27 AM To: boost-users@lists.boost.org 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@12() Unknown ntdll.dll!__RtlUserThreadStart() Unknown ntdll.dll!__RtlUserThreadStart@8() Unknown ====8<==== _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Lars Viklund | zao@acc.umu.se
On Fri, Dec 13, 2013 at 6:38 PM, Lars Viklund <zao@acc.umu.se> 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-in... 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@lists.boost.org] On Behalf Of Lars Viklund Sent: Saturday, December 14, 2013 12:27 AM To: boost-users@lists.boost.org 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@12() Unknown ntdll.dll!__RtlUserThreadStart() Unknown ntdll.dll!__RtlUserThreadStart@8() Unknown ====8<==== _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Lars Viklund | zao@acc.umu.se _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
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-in... Plausible workaround: avoid initializer lists, especially of VS20XX is your target. Other than that, HTH and good luck.
+1 for digging this out. This is a really nasty compiler bug indeed. It would indeed make sense, since string_flyweight is the complex type where the compiler would trash the memory. You could try with other types just to verify, but this indeed seems to be the compiler's fault and not yours. Mit freundlichen Grüßen / With best regards Andreas Iwanowski - IT Administrator / Software Developer www.awato.de | namezero@afim.info T: +49 (0)2133 26031 55 | F: +49 (0)2133 26031 01 awato Software GmbH | Salm Reifferscheidt Allee 37 | D-41540 Dormagen avisor-Support | T: +49 (0)621 6094 043 | F: +49 (0)621 6071 447 Geschäftsführer: Ursula Iwanowski | HRB: Neuss 7208 | VAT-no.: DE 122796158
El 14/12/2013 2:03, Andreas M. Iwanowski escribió:
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-in... Plausible workaround: avoid initializer lists, especially of VS20XX is your target. Other than that, HTH and good luck. +1 for digging this out. This is a really nasty compiler bug indeed. It would indeed make sense, since string_flyweight is the complex type where the compiler would trash the memory. You could try with other types just to verify, but this indeed seems to be the compiler's fault and not yours.
I haven't tried, but maybe replacing the problematic initialization with std::vector<Variant> v = { 1., true, "toto"}; can work around the compiler bug (can't try myself), in case it helps somehow. Joaquín M López Muñoz Telefónica Digital ________________________________ Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo. This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at: http://www.tid.es/ES/PAGINAS/disclaimer.aspx
Hi Guys, Declaring the flyweight outside the bracket fixes the crash. This is indeed this issue http://connect.microsoft.com/VisualStudio/feedback/details/800104/ Just need to wait for the update now :) Thanks to all of you for your feedback Regards, -- Olivier TRISTAN uvi.net
participants (5)
-
Andreas M. Iwanowski
-
Joaquín Mª López Muñoz
-
Lars Viklund
-
Michael Powell
-
Olivier Tristan