Opened 13 years ago

Closed 13 years ago

#3046 closed Bugs (invalid)

msvc9 boost::regex crashes with _SECURE_SCL=0

Reported by: Sven Olsen <sven2718@…> Owned by: John Maddock
Milestone: Boost 1.40.0 Component: regex
Version: Boost 1.38.0 Severity: Problem
Keywords: Cc:

Description

A bunch of my boost::regex code started crashing when I upgraded to from msvc8 to msvc9.

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.

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.

I've included a small test file and msvs project file that replicate the crash.

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.

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.

Attachments (2)

regextests.zip (2.6 KB ) - added by Sven Olsen <sven2718@…> 13 years ago.
regextests.2.zip (2.8 KB ) - added by Sven Olsen <sven2718@…> 13 years ago.
(bug only occurs in release mode, so, i took out the debug configuration)

Download all attachments as: .zip

Change History (3)

by Sven Olsen <sven2718@…>, 13 years ago

Attachment: regextests.zip added

by Sven Olsen <sven2718@…>, 13 years ago

Attachment: regextests.2.zip added

(bug only occurs in release mode, so, i took out the debug configuration)

comment:1 by John Maddock, 13 years ago

Resolution: invalid
Status: newclosed

Hi Sven,

This is a known issue with _SECURE_SCL: changing this from the default setting changes the ABI of microsofts standard library. 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.

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.

HTH, John.

Note: See TracTickets for help on using tickets.