Boost C++ Libraries: Ticket #5363: Regex library crash https://svn.boost.org/trac10/ticket/5363 <p> On Cygwin if we link to the gcc version of the regex library, regex_match will cause a crash. The following code: #include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;string&gt; #include &lt;boost/regex.hpp&gt; </p> <p> using namespace std; </p> <p> int main(int argc, char <strong>argv) { </strong></p> <blockquote> <p> boost::regex re; boost::cmatch matches; </p> </blockquote> <blockquote> <p> boost::regex_match("abc", matches, re.assign("(a)bc")); </p> </blockquote> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> <p> Compiled with: g++ regex.cpp -lboost_regex-gcc-mt </p> <p> Will crash with the following backtrace: <a class="missing ticket">#0</a> 0x6961deb0 in cygboost_regex-gcc-mt-1_33_1!_ZNK5boost9re_detail31cpp_regex_traits_implementationIcE20lookup_classname_impEPKcS4_ () </p> <blockquote> <p> from /usr/bin/cygboost_regex-gcc-mt-1_33_1.dll </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1" title="#1: Bugs: boost.build causes ftjam to segfault (closed: Wont Fix)">#1</a> 0x69607bc8 in cygboost_regex-gcc-mt-1_33_1!_ZN5boost9re_detail12perl_matcherIPKcSaINS_9sub_matchIS3_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE14construct_initERKNS_11basic_regexIcSA_EENS_15regex_constants12_match_flagsE () </p> <blockquote> <p> from /usr/bin/cygboost_regex-gcc-mt-1_33_1.dll </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a> 0x0040781a in perl_matcher (this=0x22c110, first=0x40b11a "abc", </p> <blockquote> <p> end=0x40b11d "", what=@0x22ccd4, e=@0x22cd00, f=boost::regex_constants::match_default, l_base=0x40b11a "abc") at /usr/include/boost/regex/v4/perl_matcher.hpp:371 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3" title="#3: Bugs: automatic conversion and overload proble (closed: fixed)">#3</a> 0x00401d5b in boost::regex_match&lt;char const*, std::allocator&lt;boost::sub_match&lt;char const*&gt; &gt;, char, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt; (first=0x40b11a "abc", last=0x40b11d "", m=@0x22ccd4, e=@0x22cd00, </p> <blockquote> <p> flags=boost::regex_constants::match_default) at /usr/include/boost/regex/v4/regex_match.hpp:49 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4" title="#4: Bugs: any_ptr in any library documentation? (closed: Fixed)">#4</a> 0x00401df2 in boost::regex_match&lt;char, std::allocator&lt;boost::sub_match&lt;char const*&gt; &gt;, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt; ( </p> <blockquote> <p> str=0x40b11a "abc", m=@0x22ccd4, e=@0x22cd00, flags=boost::regex_constants::match_default) at /usr/include/boost/regex/v4/regex_match.hpp:73 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5" title="#5: Bugs: shared_ptr and self-owning objects (closed: Fixed)">#5</a> 0x0040127b in main () at regex.cpp:13 </p> <p> This is on Cygwin and the version of the library is: 1.33.1-4. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5363 Trac 1.4.3 John Maddock Thu, 24 Mar 2011 12:07:07 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5363#comment:1 https://svn.boost.org/trac10/ticket/5363#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">worksforme</span> </li> </ul> <p> I tried this with the latest Cygwin packages (Boost-1.43) and it works just fine for me. </p> Ticket