Boost C++ Libraries: Ticket #3046: msvc9 boost::regex crashes with _SECURE_SCL=0 https://svn.boost.org/trac10/ticket/3046 <p> A bunch of my boost::regex code started crashing when I upgraded to from msvc8 to msvc9. </p> <p> After some frustration, I discovered that I could fix the crashes by defining BOOST_NO_STD_ALLOCATOR -- a flag currently defined for msvc8, but not msvc9. </p> <p> I'm fairly sure that these crashes are due to some subtle bug in the microsoft compiler -- though how said bug is related to the std allocator issue is unclear to me. </p> <p> I've included a small test file and msvs project file that replicate the crash. </p> <p> I'm running against the boostpro packaged windows installers for 1.38 -- I'm afraid I'm too pressed for time atm to compile the latest sources myself. </p> <p> As best I can tell, there have been no changes in 1.39 or the svn that would address this bug, but, if it has been fixed in the latest versions, I apologize. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3046 Trac 1.4.3 Sven Olsen <sven2718@…> Tue, 19 May 2009 04:34:05 GMT attachment set https://svn.boost.org/trac10/ticket/3046 https://svn.boost.org/trac10/ticket/3046 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">regextests.zip</span> </li> </ul> Ticket Sven Olsen <sven2718@…> Tue, 19 May 2009 04:40:52 GMT attachment set https://svn.boost.org/trac10/ticket/3046 https://svn.boost.org/trac10/ticket/3046 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">regextests.2.zip</span> </li> </ul> <p> (bug only occurs in release mode, so, i took out the debug configuration) </p> Ticket John Maddock Tue, 19 May 2009 11:35:11 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3046#comment:1 https://svn.boost.org/trac10/ticket/3046#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> Hi Sven, </p> <p> This is a known issue with _SECURE_SCL: changing this from the default setting <strong>changes the ABI of microsofts standard library</strong>. As a result you cannot link code compiled with _SECURE_SCL=0 against any library (including Boost.Regex) which has been compiled with the default compiler options for this flag. If you want to use _SECURE_SCL=0 in your code, then you will need to build Boost.Regex with the same setting. </p> <p> One quick fix would be to add the .cpp files for Boost.Regex (in libs/regex/src) directly to your projects src files folder then set the #define BOOST_REGEX_NO_LIB along with _SECURE_SCL=0 in the project settings and rebuild everything. </p> <p> HTH, John. </p> Ticket